gmx入门-1.类比amber

  • GROMACS流程(使用GMX-5.0)

gmx help (module) 或 gmx (module) -h

学了AMBER之后来理解GROMACS更舒服了,而且中文讲解更清晰,AMBER在核酸领域比GROMACS更强,蛋白质差不多,材料领域用LAMMPS
本来想学gaussian的,但是gaussian还没弄到win版,先学gromacs吧

pdb文件——gmx=tleap 产生gro和top两个文件——gro处理后用于溶剂化+坐标文件mdp写复合文件tpr

  • 预平衡(以毒素肽为例)
    不是必需的,看初始结构是否平衡。包括:

    1. 能量最小化:使得MD时快速达到平衡,也可以补充需要的离子然后min
    2. 蛋白质位置限制性模拟:限制重原子维持蛋白质结构,放开蛋白质分子的位置限制进行模拟
    3. NVT预平衡:先做NVT减小盒子内压力,防NPT时体系崩溃,再做NPT
      综上:min-NVT-NPT

      处理pdb

    • 上网下载:wget http://www.rcsb.org/pdb/files/1OMB.pdb
    • 需要处理的方面包括但不限于:
      · 氢原子
      · C端氧原子
      · 结晶水
      · 缺失原子/残基/侧链
      · 二硫键
      · 带电残基

    • 对于1OMB:去氢加上末尾C端结束的氧原子及其类型OXT使用win上 deepview转换,并去掉SPDBV开头行,直接到END就好
      Build->Add C-terminal Oxygen (OXT)
      File->Save->Current Layer

    • 注意,优秀的ftp系统能够处理Win-Linux的文本转换,但最好
      to_unix filename filename

      RedHat系统还可以用:dos2unix

      fws.pdb文件中已经不含氢原子, 删除了SEQRES, SHEET, SSBOND, CONECT信息, 并且添加了OXT原子.

      gmx获取拓扑—-pdb2gmx module

      gmx-5.x
      gmx pdb2gmx -f fws.pdb -o fws.gro -p fws.top -i fws.itp -ff amber99sb-ildn -water tip3p -ignh
      忽略氢,力场amber99sb-ILDN file:pdb,输出gromacs文件,输出top文件,水盒子
      产生结构文件gro,拓扑文件top,位置限制文件itp
      可以不用ff,会问你用哪个力场

      -ignh: 忽略氢原子,因本pdb文件来自NMR,含氢。统一使用GROMOS力场的氢原子命名规则, 以免名称不一致.
      -ff: 指定使用的力场. 用Amber99SB-ILDN力场. 也可以使用其他力场, 根据体系选择.
      -f: 指定预处理的蛋白质结构文件
      -o: 指定新生成的GROMACS文件名(也可以是其它的文件类型, 如pdb)
      -p: 指定新生成的拓扑文件名, 包含所有原子及原子间的相互作用参数
      -water: 指定水模型. 使用TIP3P水模型. 也可以使用如SPC/E.

      gmx pdb2gmx [-f [<.gro/.g96/…>]] [-o [<.gro/.g96/…>]] [-p [<.top>]]

        [-i [<.itp>]] [-n [<.ndx>]] [-q [<.gro/.g96/...>]]
        [-chainsep <enum>] [-merge <enum>] [-ff <string>] [-water <enum>]
        [-[no]inter] [-[no]ss] [-[no]ter] [-[no]lys] [-[no]arg]
        [-[no]asp] [-[no]glu] [-[no]gln] [-[no]his] [-angle <real>]
        [-dist <real>] [-[no]una] [-[no]ignh] [-[no]missing] [-[no]v]
        [-posrefc <real>] [-vsite <enum>] [-[no]heavyh] [-[no]deuterate]
        [-[no]chargegrp] [-[no]cmap] [-[no]renum] [-[no]rtpres]
      
        -o      [<.gro/.g96/...>]  (conf.gro)  Structure file: gro g96 pdb brk ent esp
        -p      [<.top>]           (topol.top)       Topology file
        -i      [<.itp>]           (posre.itp)         Include file for topology
      

      建模拟溶剂盒子—-editconf module(或许可以删除)

      gmx-5.x
      gmx editconf -f fws.gro -o fws-PB.gro -bt dodecahedron -d 1.2
      -f: 输入蛋白结构
      -o: 输出带模拟周期性溶剂盒子信息的结构文件 perodic box PB
      -bt: 默认使用长方盒子, 可以使用-bt选项改变盒子类型, 如八面体, 十二面体等,菱形十二面体盒子接近球形, 计算效率最高
      -d: 蛋白与模拟盒子在X, Y, Z方向上的最小距离,不能小于0.9 nm
      生成一个 xxx-PBC.gro文件,得到了置于周期性菱形盒子中的蛋白质分子

      gmx editconf [-f [<.gro/.g96/…>]] [-n [<.ndx>]] [-bf [<.dat>]]

         [-o [<.gro/.g96/...>]] [-mead [<.pqr>]] [-[no]w] [-[no]ndef]
         [-bt <enum>] [-box <vector>] [-angles <vector>] [-d <real>]
         [-[no]c] [-center <vector>] [-aligncenter <vector>]
         [-align <vector>] [-translate <vector>] [-rotate <vector>]
         [-[no]princ] [-scale <vector>] [-density <real>] [-[no]pbc]
         [-resnr <int>] [-[no]grasp] [-rvdw <real>] [-[no]sig56]
         [-[no]vdwread] [-[no]atom] [-[no]legend] [-label <string>]
         [-[no]conect]
      

      -bt (triclinic)

       Box type for -box and -d: triclinic, cubic, dodecahedron,
       octahedron
      

      -box (0 0 0)

        Box vector lengths (a,b,c)
      

      -angles (90 90 90)

       Angles between the box vectors (bc,ac,ab)
      

      -d (0)

       Distance between the solute and the box
      
        可用于转换GROMACS文件(*.gro)和pdb文件(*.pdb) 
            '''
                editconf -f file.gro -o file.pdb 
            '''
      

      (添加离子?)gmx genion -s

      真空能量最小化 (vac min)准备—-grompp module

      gmx grompp -f fws-VM.mdp -c fws-PB.gro -p fws.top -o fws-VM.tpr -maxwarn 1

    • 参数文件mdp,GROMACS预处理器grompp(即gromacs pre-processor的缩写)进行处理。注:shift/cutoff的单位为nm, UA=united atom, AA=all-atom, DispCorr只能和周期性边界条件一起使用.
      vac-min-fws.mdp
      ; 传递给预处理器的一些定义
      define = -DFLEXIBLE ; 使用柔性水模型而非刚性模型, 这样最陡下降法可进一步最小化能量

      ; 模拟类型, 结束控制, 输出控制参数
      integrator = steep ; 指定使用最陡下降法进行能量最小化. 若设为cg则使用共轭梯度法
      emtol = 500.0 ; 若力的最大值小于此值则认为能量最小化收敛(单位kJ mol^-1^ nm^-1^)
      emstep = 0.01 ; 初始步长(nm)
      nsteps = 1000 ; 在能量最小化中, 指定最大迭代次数
      nstenergy = 10 ; 能量写出频率
      energygrps = System ; 要写出的能量组

      ; 近邻列表, 相互作用计算参数
      nstlist = 1 ; 更新近邻列表的频率. 1表示每步都更新
      ns_type = grid ; 近邻列表确定方法(simple或grid)
      coulombtype = PME ; 计算长程静电的方法. PME为粒子网格Ewald方法, 还可以使用cut-off
      rlist = 1.0 ; 短程力近邻列表的截断值
      rcoulomb = 1.0 ; 长程库仑力的截断值
      vdwtype = cut-off ; 计算范德华作用的方法
      rvdw = 1.0 ; 范德华距离截断值
      constraints = none ; 设置模型中使用的约束
      pbc = xyz ; 3维周期性边界条件

    • 这里有一个初学者的bug,似乎与top文件电荷未处理有关,论坛指出加一个-maxwarn 1就好了,产生mdout.mdp和运行输入文件fws-VM.tpr(动力学输入文件,包括压缩的初始结构,拓扑,模拟力场信息)

      gmx grompp [-f [<.mdp>]] [-c [<.gro/.g96/…>]] [-r [<.gro/.g96/…>]]

       [-rb [<.gro/.g96/...>]] [-n [<.ndx>]] [-p [<.top>]]
       [-t [<.trr/.cpt/...>]] [-e [<.edr>]] [-ref [<.trr/.cpt/...>]]
       [-po [<.mdp>]] [-pp [<.top>]] [-o [<.tpr>]] [-imd [<.gro>]]
       [-[no]v] [-time <real>] [-[no]rmvsbds] [-maxwarn <int>]
       [-[no]zero] [-[no]renum]
      

      Options to specify input files:
      -f [<.mdp>] (grompp.mdp)

            grompp input file with MD parameters
      

      -c [<.gro/.g96/…>] (conf.gro)

            Structure file: gro g96 pdb brk ent esp tpr
      

      -r [<.gro/.g96/…>] (restraint.gro) (Opt.)

            Structure file: gro g96 pdb brk ent esp tpr
      

      -rb [<.gro/.g96/…>] (restraint.gro) (Opt.)

            Structure file: gro g96 pdb brk ent esp tpr
      

      -n [<.ndx>] (index.ndx) (Opt.)

            Index file
      

      -p [<.top>] (topol.top)

            Topology file
      

      -t [<.trr/.cpt/…>] (traj.trr) (Opt.)

            Full precision trajectory: trr cpt tng
      

      -e [<.edr>] (ener.edr) (Opt.)

            Energy file
      

      Options to specify input/output files:
      -ref [<.trr/.cpt/…>] (rotref.trr) (Opt.)

            Full precision trajectory: trr cpt tng
      

      Options to specify output files:
      -po [<.mdp>] (mdout.mdp)

            grompp input file with MD parameters
      

      -pp [<.top>] (processed.top) (Opt.)

            Topology file
      

      -o [<.tpr>] (topol.tpr)

            Portable xdr run input file
      

      -imd [<.gro>] (imdgroup.gro) (Opt.)

            Coordinate file in Gromos-87 format
      

      Other options:
      -[no]v (no)

            Be loud and noisy
      

      -time (-1)

            Take frame at or first after this time.
      

      -[no]rmvsbds (yes)

            Remove constant bonded interactions with virtual sites
      

      -maxwarn (0)

            Number of allowed warnings during input processing. Not for normal
            use and may generate unstable systems
      

      -[no]zero (no)

            Set parameters for bonded interactions without defaults to zero
            instead of generating an error
      

      -[no]renum (yes)

            Renumber atomtypes and minimize number of atomtypes
      

      跑个动力学能量最小化—-mdrun(值得研究参数)

      gmx mdrun -v -deffnm fws-VM

    • 用tpr文件做md能量最小化
    • -deffnm指定默认的文件名称, -v显示模拟过程中的信息
    • 注:我们得到了日志文件fws-VM.log, 全精度轨迹文件fws-VM.trr, 能量文件fws-VM.edr, 能量最小化后的结构文件fws-VM.gro.
    • 说明: 如果最小化不收敛, 可以将nsteps的数值增大再重新提交一次. 要重新提交作业的话, 你需要重新运行grompp.
    • 对能量最小化的讨论 http://mdbbs.org/thread-22150-1-1.html

        gmx mdrun [-s [<.tpr>]] [-cpi [<.cpt>]] [-table [<.xvg>]] [-tablep [<.xvg>]]
        [-tableb [<.xvg> [...]]] [-rerun [<.xtc/.trr/...>]] [-ei [<.edi>]]
        [-multidir [<dir> [...]]] [-awh [<.xvg>]] [-membed [<.dat>]]
        [-mp [<.top>]] [-mn [<.ndx>]] [-o [<.trr/.cpt/...>]]
        [-x [<.xtc/.tng>]] [-cpo [<.cpt>]] [-c [<.gro/.g96/...>]]
        [-e [<.edr>]] [-g [<.log>]] [-dhdl [<.xvg>]] [-field [<.xvg>]]
        [-tpi [<.xvg>]] [-tpid [<.xvg>]] [-eo [<.xvg>]] [-devout [<.xvg>]]
        [-runav [<.xvg>]] [-px [<.xvg>]] [-pf [<.xvg>]] [-ro [<.xvg>]]
        [-ra [<.log>]] [-rs [<.log>]] [-rt [<.log>]] [-mtx [<.mtx>]]
        [-if [<.xvg>]] [-swap [<.xvg>]] [-deffnm <string>] [-xvg <enum>]
        [-dd <vector>] [-ddorder <enum>] [-npme <int>] [-nt <int>]
        [-ntmpi <int>] [-ntomp <int>] [-ntomp_pme <int>] [-pin <enum>]
        [-pinoffset <int>] [-pinstride <int>] [-gpu_id <string>]
        [-gputasks <string>] [-[no]ddcheck] [-rdd <real>] [-rcon <real>]
        [-dlb <enum>] [-dds <real>] [-gcom <int>] [-nb <enum>]
        [-nstlist <int>] [-[no]tunepme] [-pme <enum>] [-pmefft <enum>]
        [-bonded <enum>] [-[no]v] [-pforce <real>] [-[no]reprod]
        [-cpt <real>] [-[no]cpnum] [-[no]append] [-nsteps <int>]
        [-maxh <real>] [-replex <int>] [-nex <int>] [-reseed <int>]
      

      -deffnm 统一所有文件名称
      -x 可以将所有文件压缩进xtc或者是tng文件
      -mtx 导出hessian matrix

        -s      [<.tpr>]           (topol.tpr)
        Portable xdr run input file
        -cpi    [<.cpt>]           (state.cpt)      (Opt.)
                Checkpoint file
        -table  [<.xvg>]           (table.xvg)      (Opt.)
                xvgr/xmgr file
        -tablep [<.xvg>]           (tablep.xvg)     (Opt.)
                xvgr/xmgr file
        -tableb [<.xvg> [...]]     (table.xvg)      (Opt.)
                xvgr/xmgr file
        -rerun  [<.xtc/.trr/...>]  (rerun.xtc)      (Opt.)
                Trajectory: xtc trr cpt gro g96 pdb tng
        -ei     [<.edi>]           (sam.edi)        (Opt.)
                ED sampling input
        -multidir [<dir> [...]]    (rundir)         (Opt.)
                Run directory
        -awh    [<.xvg>]           (awhinit.xvg)    (Opt.)
                xvgr/xmgr file
        -membed [<.dat>]           (membed.dat)     (Opt.)
                Generic data file
        -mp     [<.top>]           (membed.top)     (Opt.)
                Topology file
        -mn     [<.ndx>]           (membed.ndx)     (Opt.)
                Index file
      
        Options to specify output files:
        -o      [<.trr/.cpt/...>]  (traj.trr)
                Full precision trajectory: trr cpt tng
        -x      [<.xtc/.tng>]      (traj_comp.xtc)  (Opt.)
                Compressed trajectory (tng format or portable xdr format)
        -cpo    [<.cpt>]           (state.cpt)      (Opt.)
                Checkpoint file
        -c      [<.gro/.g96/...>]  (confout.gro)
                Structure file: gro g96 pdb brk ent esp
        -e      [<.edr>]           (ener.edr)
                Energy file
        -g      [<.log>]           (md.log)
                Log file
        -dhdl   [<.xvg>]           (dhdl.xvg)       (Opt.)
                xvgr/xmgr file
        -field  [<.xvg>]           (field.xvg)      (Opt.)
                xvgr/xmgr file
        -tpi    [<.xvg>]           (tpi.xvg)        (Opt.)
                xvgr/xmgr file
        -tpid   [<.xvg>]           (tpidist.xvg)    (Opt.)
                xvgr/xmgr file
        -eo     [<.xvg>]           (edsam.xvg)      (Opt.)
                xvgr/xmgr file
        -devout [<.xvg>]           (deviatie.xvg)   (Opt.)
                xvgr/xmgr file
        -runav  [<.xvg>]           (runaver.xvg)    (Opt.)
                xvgr/xmgr file
        -px     [<.xvg>]           (pullx.xvg)      (Opt.)
                xvgr/xmgr file
        -pf     [<.xvg>]           (pullf.xvg)      (Opt.)
                xvgr/xmgr file
        -ro     [<.xvg>]           (rotation.xvg)   (Opt.)
                xvgr/xmgr file
        -ra     [<.log>]           (rotangles.log)  (Opt.)
                Log file
        -rs     [<.log>]           (rotslabs.log)   (Opt.)
                Log file
        -rt     [<.log>]           (rottorque.log)  (Opt.)
                Log file
        -mtx    [<.mtx>]           (nm.mtx)         (Opt.)
                Hessian matrix
        -if     [<.xvg>]           (imdforces.xvg)  (Opt.)
                xvgr/xmgr file
        -swap   [<.xvg>]           (swapions.xvg)   (Opt.)
                xvgr/xmgr file
      
        Other options:
      
        -deffnm <string>
                Set the default filename for all file options
        -xvg    <enum>             (xmgrace)
                xvg plot formatting: xmgrace, xmgr, none
        -dd     <vector>           (0 0 0)
                Domain decomposition grid, 0 is optimize
        -ddorder <enum>            (interleave)
                DD rank order: interleave, pp_pme, cartesian
        -npme   <int>              (-1)
                Number of separate ranks to be used for PME, -1 is guess
        -nt     <int>              (0)
                Total number of threads to start (0 is guess)
        -ntmpi  <int>              (0)
                Number of thread-MPI ranks to start (0 is guess)
        -ntomp  <int>              (0)
                Number of OpenMP threads per MPI rank to start (0 is guess)
        -ntomp_pme <int>           (0)
                Number of OpenMP threads per MPI rank to start (0 is -ntomp)
        -pin    <enum>             (auto)
                Whether mdrun should try to set thread affinities: auto, on, off
        -pinoffset <int>           (0)
                The lowest logical core number to which mdrun should pin the first
                thread
        -pinstride <int>           (0)
                Pinning distance in logical cores for threads, use 0 to minimize
                the number of threads per physical core
        -gpu_id <string>
                List of unique GPU device IDs available to use
        -gputasks <string>
                List of GPU device IDs, mapping each PP task on each node to a
                device
        -[no]ddcheck               (yes)
                Check for all bonded interactions with DD
        -rdd    <real>             (0)
                The maximum distance for bonded interactions with DD (nm), 0 is
                determine from initial coordinates
        -rcon   <real>             (0)
                Maximum distance for P-LINCS (nm), 0 is estimate
        -dlb    <enum>             (auto)
                Dynamic load balancing (with DD): auto, no, yes
        -dds    <real>             (0.8)
                Fraction in (0,1) by whose reciprocal the initial DD cell size will
                be increased in order to provide a margin in which dynamic load
                balancing can act while preserving the minimum cell size.
        -gcom   <int>              (-1)
                Global communication frequency
        -nb     <enum>             (auto)
                Calculate non-bonded interactions on: auto, cpu, gpu
        -nstlist <int>             (0)
                Set nstlist when using a Verlet buffer tolerance (0 is guess)
        -[no]tunepme               (yes)
                Optimize PME load between PP/PME ranks or GPU/CPU (only with the
                Verlet cut-off scheme)
        -pme    <enum>             (auto)
                Perform PME calculations on: auto, cpu, gpu
        -pmefft <enum>             (auto)
                Perform PME FFT calculations on: auto, cpu, gpu
        -bonded <enum>             (auto)
                Perform bonded calculations on: auto, cpu, gpu
        -[no]v                     (no)
                Be loud and noisy
        -pforce <real>             (-1)
                Print all forces larger than this (kJ/mol nm)
        -[no]reprod                (no)
                Try to avoid optimizations that affect binary reproducibility
        -cpt    <real>             (15)
                Checkpoint interval (minutes)
        -[no]cpnum                 (no)
                Keep and number checkpoint files
        -[no]append                (yes)
                Append to previous output files when continuing from checkpoint
                instead of adding the simulation part number to all file names
        -nsteps <int>              (-2)
                Run this number of steps (-1 means infinite, -2 means use mdp
                option, smaller is invalid)
        -maxh   <real>             (-1)
                Terminate after 0.99 times this time (hours)
        -replex <int>              (0)
                Attempt replica exchange periodically with this period (steps)
        -nex    <int>              (0)
                Number of random exchanges to carry out each exchange interval (N^3
                is one suggestion).  -nex zero or not specified gives neighbor
                replica exchange.
        -reseed <int>              (-1)
                Seed for replica exchange, -1 is generate a seed
      

      溶剂化再最小化

      gmx-5.x
      gmx solvate -cp fws-VM.gro -cs spc216.gro -p fws.top -o fws-ion.gro

    • -cp指定需要填充水分子的体系, 带模拟蛋白盒子, -cs指定使用SPC水模型进行填充, spc216是GROMACS统一的三位点水分子结构, -p修改体系的拓扑文件, 加入相应水分子的物理参数 -o指定填充水分子后的输出文件.

      最小化参数文件

        fws-VM-sol.mdp
            define          = -DFLEXIBLE
      
            integrator      = steep
            emtol           = 250.0
            nsteps          = 5000
            nstenergy       = 10
            energygrps      = System
      
            nstlist         = 1
            ns_type         = grid
            coulombtype     = PME
            rlist           = 1.0
            rcoulomb        = 1.0
            rvdw            = 1.0
            constraints     = none
            pbc             = xyz
      

      准备命令同理
      gmx grompp -f fws-VM-sol.mdp -c fws-ion.gro -p fws.top -o ion.tpr -maxwarn 1

      基于tpr文件加离子—-genion

      gmx genion -s ion.tpr -o fws-b4em.gro -neutral -conc 0.15 -p fws.top

    • -neutral选项保证体系总的净电荷为零, 体系呈电中性, -conc选项设定需要的离子浓度(这里为0.15 M). -g选项指定输出日志文件的名称. -norandom选项会依据静电势来放置离子而不是随机放置(默认), 但我们在这里使用随机放置方法.
    • 运行这个命令时, 会提示选择一个连续的溶剂分子组, 选择13 (SOL), 回车, 程序会告知你有两个溶剂分子被氯离子代替. fws.top中会包含NA和CL离子. 注意, 这里出现的分子顺序必须与坐标文件中的一致.
    • 说明: genion默认使用的盐为NaCl. 如果你需要使用不同的阳离子和阴离子, 可使用-pname(阳离子)和-nname(阴离子)分别指定阴阳离子的名称(根据相应力场的ions.itp文件中离子的设定), 还可以使用-pn和-nn分别指定添加的阴离子数目.

      gmx grompp -f fws-VM-sol.mdp -c fws-b4em.gro -p fws.top -o fws-VM-sol.tpr

      gmx mdrun -v -deffnm fws-VM-sol

      位置限制

      NVT
      gmx grompp -f nvt-pr-md.mdp -c fws-VM-sol.gro -p addoxt.top -o nvt-pr.tpr -r em-sol.gro -nt 8
      报错:
      Cannot find position restraint file restraint.gro (option -r).From GROMACS-2018, you need to specify the position restraint coordinate files explicitly to avoid mistakes, although you can still use the same file as you specify for the -c option.

      • 版本迭代问题,在最新的教程下看到确实是加入了-r em-sol.gro
        报错:
        Fatal error:

        There is no domain decomposition for 32 ranks that is compatible with the
        given box and a minimum cell size of 0.95325 nm
        Change the number of ranks or mdrun option -rcon or -dds or your LINCS
        settings
        
        • 与core的thread问题有关 命令后加个 -nt 1
          https://jerkwin.github.io/GMX/GMXtut-10/#5-%E9%94%99%E8%AF%AF%E4%BF%A1%E6%81%AF 对问题的探讨
          或者不想那么多,改一个 -nt 2试试,-nt 1 真的太慢了感觉。
          改成 -nt 8 线程明显快多了,不知道最高可以多少线程
          On 1 MPI rank, each using 8 OpenMP threads

          • 并行运算
            需要把盒子划分成小单元并行计算,使用PME方法计算计算静电相互作用时, 还可以指定一些节点单独用于PME计算, 这些节点被称为PME节点. GROMACS通常会自动进行这些设置, 但当模拟体系具有很高或很低的空间不均匀性时(例如, 模拟真空中的板块), 可能需要自己对这些设置进行调整以达到更好的性能.

        位置限制性预平衡模拟,使溶剂和离子弛豫运动,然后等压升温。走一个NVT和一个NPT
        说明: 当模拟运行时间较长时, 你可以使用后台运行方法, 如
        gmx-4.x: nohup mdrun -deffnm npt-pr &
        gmx-5.x: nohup gmx mdrun -deffnm npt-pr &
        为检查模拟运行进度, 可使用tail命令查看日志文件, 如
        tail -n 25 npt-pr.log
        或者
        tail -f npt-pr.log持续输出

这个教程挺好的

http://www.mdtutorials.com/gmx/lysozyme/index.htmlhttp://www.mdtutorials.com/gmx/lysozyme/index.html

Screen

screen -S 文件名
比nohup好用 screen ctrl+a +d退出 ctrl+r继续 screen -ls有哪些窗口 screen -r 数字恢复

用top查看正在进行的进程

screen命令详解,https://www.cnblogs.com/mchina/archive/2013/01/30/2880680.html

调mdp文件integrator为nm,而不是steep或者md

Hessian十进制化

近来用GROMACS做简正模式分析(NMA),做完之后,想做后续工作需要用到Hessian矩阵和特征值和特征向量。但是GMX输出的特征值是十进制格式,输出的Hessian(.mtx)和特征向量(.trr)都是二进制文件,无法直接读出。
结果花了好多天的力气,曾试图改GMX底层代码,看了好多天他的c文件,结果头大。无奈又翻了几遍手册,发现居然有专门读取GMX二进制文件的命令~ 具体操作如下
gromacs 4.5版本 gmxdump -f xxx.trr -om xxx.mdp >>xxx.txt
gromacs 5+版本 gmx dump -f xxx.trr -om xxx.mdp >>xxx.txt
这里如果不加上>>后边的这段,仅仅是写上xxx.mdp,是不会输出任何文件。我也不清楚为啥,只有将它转化为txt才有输出

双精度文本不支持gpu加速

Gromacs有Python包gromacs wrapper,Fl studio也有python包

数字特征分析:比如主要分布在哪里,(或者可以切片然后整体分析,值得考虑)
    某个区和某个区配对排序,或者不同正则运动方式配对排序
    排序后列矩阵,互为音高音强
    每个音乐的特点
    数字特征
音乐

所以能不能用python脚本处理输入的蛋白/分子结构然后输出个中国风音乐或者是电音?
音阶了解一下

进一步的问题是如何写这个音乐了,如何模块化实现呢?

不过可以先不在python框架下,而是先把流程实现了。
顺便可以整点web的东西?

(弯曲振动为音高,伸缩振动为音强)
eigenfreq.xvg
eigenval.xvg
eigenvec.trr

A0 MD

pmemd 跑MD流程

  1. 使用N卡(NVIDA)可以在GPU上跑,并行加速
  2. 此前准备阶段已经生成了top和crd文件,需要进行能量最小化,升温两步达到平衡,然后MD模拟
    注:溶剂盒子似乎影响电荷以及最小化过程
  • 创建三个文件 01_min.in 02_heat.in 03_MD.in




  • 能量最小化
    命令
    $AMBERHOME/bin/sander -O -i 01_min.in -o 01_min.out -p name.top -c name.crd -r 01_min.rst -inf 01_min.mdinfo
    pmemd似乎做不了
    拓扑文件(势能函数)不变,crd文件转为输出的rst文件里,包括坐标和速度

  • 升温
    命令

利用min的rst和势能,输出升温后的轨迹文件,以及info。速度0.2s一百步,一万步20s

  • MD
    用sander可以实现

pmemd更好,额外需要一个jobfile.sh跑显卡

使用命令后台运行md并检查情况
nohup ./Jobfile_production.sh &
nvidia-smi

  • 报错:

    1
    2
    nohup: ignoring input and appending output to 'nohup.out'
    nohup: failed to run command './jobfile_md.sh': Permission denied

    原因是nohup会把错误信息输出出来,但还没输出前就发现out文件输出位置没有权限建立文件
    使用Linux重定向,2代表错误输出,1代表标准输出,0代表标准输入。 只要让二者都不输出或者重新定向位置就好了。(这里似乎是都不输出)
    使用
    chmod +x jobfile_md.sh
    nohup ./jobfile_md.sh 2>log
    把文本变得可执行,然后把问题输出到log里,报错不平衡,原子解散了,说明还不够平衡;当然也有可能是升温时间太短了??
    ERROR: Calculation halted. Periodic box dimensions have changed too much from their initial values.
    Your system density has likely changed by a large amount, probably from
    starting the simulation from a structure a long way from equilibrium.

    [Although this error can also occur if the simulation has blown up for some reason]

    The GPU code does not automatically reorganize grid cells and thus you
    will need to restart the calculation from the previous restart file.
    This will generate new grid cells and allow the calculation to continue.
    It may be necessary to repeat this restarting multiple times if your system
    is a long way from an equilibrated density.

    Alternatively you can run with the CPU code until the density has converged
    and then switch back to the GPU code.

AMBER-入门教程(四)

氢质量重排HMR

可以进行更长时间的加速分子动力学模拟,降低大分子最高运动频率,避免了氢原子由于高频振动散架如步长可以调到4fs而不是2fs
文献原理:https://pubs.acs.org/doi/full/10.1021/ct5010406

脂质力场

(待看)

蛋白晶体模拟

室温离子液体模拟

材料系统模拟

用3D-RISM替代显式溶剂

用CHARMM-GUI建立系统

Antechamber 小分子对接前准备

https://xbwang.wordpress.com/2019/04/17/amber%E5%B0%8F%E5%88%86%E5%AD%90%E5%A4%84%E7%90%86/
注意mol2里 有连接性问题,可能把ar 变成了2,双键。正常都是可以做的。

Amber进阶-黑塞矩阵在哪里

  1. 找手册

    • 1-7章提过了
    • 8章:经验共价键键模拟 计算反应
      基函数的概述 单个基函数由一个或多个原始高斯函数构成。例如,s-型基函数 φµ(r)是一个高斯分布型函数称为s-型基函数,一个壳层是一套有共同指数的基函数φµ。Gaussian支持任意角动量的壳层:s,p,d,f,g,h五层。一个s-壳层包含一个单独的s-型基函数。一个p-壳层包含三个基函数pX,pY和pZ。sp-壳层包含四个具有共同高斯指数的基函数:一个s-型函数和三个p-函数pX,pY和pZ。
    • AMBER18里搜hessian发现有一个关于second derivative的,但似乎用到mme2,不懂,也没搜到
      有一个CartHess2FC.py的模块用了output Hessian 以为是它,实际上利用的是Gaussian输出的fchk文件
      小木虫上看到很成熟的利用Gaussian解决hessian乃至找本征频率的做法,http://muchong.com/html/201504/8775391_2.html,15年就有了
    • 改变搜索思路,找fchk,找到了量子动力学模块
      PIMD可以做模拟,一种是PRIMPIMD和NMPIMD(normal mode path-integral),后者是一种更好的方式,解耦谐波项(在谐波项看到了正则化中的频率ω)

      流泪了好兄弟

      实践证明,以hessian为关键词搜一遍,发现,但凡涉及到的都是偷Gaussian的现成文件来用,也太垃圾了amber,呜呜呜,浪费我一个月啊!!!!!!!!!

      hessian的本质是3n-6个振动自由度的频率值,3n个自由度,但去掉3个振动自由度,3个转动自由度,他们的改变不影响体系相对位置,也就不改变体系能量。

Amber--入门教程(三)

使用tleap建立显式水蛋白体系

  1. 设立AMBERHOME(系统已经有了)
    bash下路径设立
    export AMBERHOME = /usr/local/想设计的路径
  2. 显式溶剂体系准备
    打开tleap模式后
    source.leaprc.water.
    一般常用TIP3P,适用于含有水的基团,也有甲醇,氯仿等模型。
    力场文件是与溶剂文件相对应的 这里使用ff14SB(推荐)对应OPC水溶剂(tip3p更常见),并对应加载OPC中的水化自由能HFE的计算。对于初学者建议不要尝试。这与似乎也与配套的GB/SA模型有关,且不是很成熟。 这里涉及第4-7章
    source leaprc.protein.ff19SB
    source leaprc.water.opc
    loadamberparams frcmod.ions1lm_126_hfe_opc

  3. 处理pdb格式
    利用上一个教程里的pdb文件
    name = loadpdb name.pdb
    根据SSBOND改cys cyx,在tleap中连接二硫键

  • 此前可以在moe里看看,实际上二硫键已经连接了,无需再bond,不知为何教程里还bond;如果再bond一次生成参数文件时会报错
    bond ramp.27.SG ramp.82.SG
    bond ramp.40.SG ramp.72.SG
    bond ramp.57.SG ramp.104.SG
    保存
    saveamberparm
    tleap值得注意的指令见附1
  1. 电中性与溶剂化
    addions name Na+ 2
    solvateoct name OPCBOX 10.0
    10.0有三层溶剂分子,并一般加入150mM NaCl,对应9.03e22 Cl- atom/L
    此时获取体积,如2.08e5 A3 = 2.08e-22L,把结果乘以1e-27。 上下相乘得需要加多少个离子
    实际结果9.0310e-5
    addionsrand name Na+ 2 Cl- 2
    注意:加入后体系体积会减小,浓度实际大于150mM
    值得思考,这里为什么是盐溶剂体系,水溶剂体系可以吗?

  2. 保存检查离子溶剂化后结果
    saveamberparm name name.top name.crd

注:以上流程可以写入一个脚本in文件 (AMBERHOME用$AMBERHOME即可使用,力场文件直接调用,省的敲一堆字)
使用source tleap.in调用
touch process.in #新建文件 使用rm命令删除 可以用空格建立两个文件 使用dd删除一行,:1,2d删除两行,ZZ保存退出
文件为

#tleap.in           #title
source leaprc.protein.ff19SB
source leaprc.water.opc
loadamberparams frcmod.ions1lm_126_hfe_opc
ramp=loadpdb RAMP1.pdb
bond ramp.27.SG ramp.82.SG
bond ramp.40.SG ramp.72.SG
bond ramp.57.SG ramp.104.SG
SaveAmberParm ramp RAMP1_gas.prmtop RAMP1_gas.inpcrd
addIons ramp Na+ 2
solvateOct ramp OPCBOX 10.0
addIonsRand ramp Na+ 19 Cl- 19 
SaveAmberParm ramp RAMP1_ion.prmtop RAMP1_ion.inpcrd

注:可以用cpptraj把输出文件写成pdb
创立一个输入转换文件pdb.in
trajin RAMP1_ion.inpcrd
trajout RAMP1_wions_water.pdb PDB
excute命令
$AMBERHOME/bin/cpptraj -p RAMP1_ion.prmtop -i pdb.in>pdb.out #没有AMBERHOME直接从cpptraj开始就可以

  1. 放松溶剂

     体系平衡弛豫,使用NVT系综(
         控制压强,计算晶格常数使用NPT等温等压,或拉伸压缩模拟
         NVE微正则,用于冲击辐照
         NPH等压等焓系综
     周期性边界(补充跑出去的原子)
    
  2. 升温平衡


附1

tleap检查信息使用
desc xxx

Amber--入门教程(二)

  1. pdb4amber准备PDB

    1
    2
    tleap
    pdb4amber name.pdb > name.mbr.pdb

    可以做一份拷贝

    1
    cp name.pdb name.process.pdb
    • 或者自己建立多肽序列(chignolin e.g.)

      1
      2
      pro = sequence{ GLY TYR ASP PRO GLU THR GLY THR TRP GLY }
      savepdb pro pro.pdb
    • 处理非标准基团
      pdb文件在MODRES中标注修饰了标准残基变成非标准残基,替换的开始位置,并把用HETATM表示,需要替换回来,否则MSE氨基酸左右没有相连
      例:
      把HETATM改为ATOM,把MSE改为MET,把SE符号改为SD(代表met中的硫),把末尾的SE改为S,注意对齐

      SSBOND定义了CYS二硫键位置
      HETATM记录标准氨基酸以及核酸以外的化合物, 包括抑制剂, 辅因子, 离子, 溶剂中的原子,默认不与其他残基相连,水分子也在其中
      对pdb文件的解读,见 https://jerkwin.github.io/2015/06/05/PDB文件格式说明/

    • 处理溶剂分子
      直接删除,若做显式水溶剂系统,可以保留水分子
    • (可选)氨基酸电子密度缺失
      pdb创建者技术不佳,导致残基缺失 可以用vmd/pymol查看是否有间断,或者直接看基团序号是否连续
    • 处理二硫键
      二硫键在amber中名为CYX,在SSBOND里找到,把对应的CYS改为CYX
      在connect里补充
    • 加氢改名问题
      因为需要给X晶体衍射结构加氢,但非标准基团自带氢或者没有氢,所以需要重命名以便加氢/不加氢

      用H++预测His的质子化位点从而改合适名字
      http://biophysics.cs.vt.edu/faq.php
      HID—δ位置N原子被质子化(多一个H)
      HIE—ε位置N原子被质子化
      HIP—两个位置都被质子化。
      具体用哪个名字,根据体系的pH值来确定,用网站预测。

    • (可选)VMD操作简单教程http://course.sdu.edu.cn/Download2/20151113131122124.pdf
      VMD的基本操作:旋转、平移和缩放。

      • 按下鼠标左键并移动鼠标,围绕平行于屏幕的轴旋转分子(a)
      • 如果是按下鼠标右键并移动,则可以绕着垂直于屏幕的轴旋转分子(b)
      • 菜单mouse选择translate mode,左键平移
        直接在load里下载pdb文件

        感觉还是moe好
        ribbon里选择bb和sc,atom选择element看,很直观,而且本地跑gui界面不卡,不然要吐了

  2. 用leap处理结构文件pdb,mol2(使用参数文件lib, prepi, parm.dat, frcmod)

    1. 加载蛋白质力场
      1
      source leaprc.protein.ff14SB
    2. 用八面体水盒子溶剂化分子

      1
      2
      3
      source leaprc.water.tip3p
      name = loadpdb "name.mbr.pdb"
      slovateOct name SPCBOX 14.0

      或使用GB隐式溶剂模型 GBneck2 radii

      1
      set default PBradii mbondi3
      • 原因:由于溶剂分子影响蛋白质结构功能,如静电相互作用降低反应活化能以及疏水作用,以及折叠稳定性,选择特异性,需要表征溶剂化效应(solvation);由于计算相对复杂,也有使用隐式溶剂模型处理成统计平均效应,降低模拟时间,但也意味着不是万能的。

      • 优化:使用GPU图形处理器作为计算平台,以及并行计算,多重网格和快速多极子方法能等计算方法

      原理:见附1

    3. 中和电荷
      • 检测电荷
        1
        charge name
      • 相应加上正负电荷,保存拓扑力场文件以及坐标文件
        1
        2
        3
        addIons name Cl- (number) 
        addIons name Na+ (number)
        saveamberparm name svt.name.top svt.name.crd

附1

  1. PB方程(poisson-boltzmann)《生物分子模拟中的静电计算》http://lsec.cc.ac.cn/~lubz/Publication/ChinaCP201502.pdf
    计算电解质溶液的静电相互作用偏微分方程,把水简化为均匀电解质,即隐式溶剂化处理。在稀溶液中可以使用Debye-Huckel方程近似
    • 适用条件:弱耦合(低表面电荷密度,低浓度的单价离子溶液,高温度)
    • 局限性:溶液中有一定浓度高价离子,导致粒子间相互作用和关联增强则不适用:
      带相同电荷的物体在高价盐溶液中相互吸引,以及带电胶体在高价盐溶液中的电泳呈现电荷反转
  2. 并行计算
    CUDA:computer unified device architecture, NVIDA开发,GPU运算,核心是C语言编辑器
    OpenML,MPI,Cilk Plus,
  3. 结果可视化
    pymol,VMD
  4. 广义Born模型 GB,对PB的改进,用于构想转变研究,以及大分子大尺度运动
  5. PB与GB都可结合表面积SA,计算蛋白质复合物结合自由能

Amber--入门教程(一)

氨基酸大分子为例

基础知识

  1. amber基础流程
    步骤流程图
    • 输入pdb文件
    • pdb4amber转换
    • leap或antechamber(非标准分子)或MCPB加载力场
    • 生成prmtop和prmcrd文件
    • 使用parmed检验并评估上述文件
    • 进行后续命令处理,利用mdin文件,NAB语言
  1. 不同名称文件包含不同信息
    不同文件信息内容
    pdb文件包含笛卡尔坐标
    prmtop文件,又名parm7,top,包含分子,原子名称、种类,电荷,键关系,键参数和非键参数信息,而inpcrd文件包含初始位置坐标
    lib文件是系统自带的连接,原子名称文件等,似乎必不可缺。(不太清楚功能)

  2. 对于标准pdb文件提供的信息,amber根据leaprc中的力场文件计算top和crd(还可以用补充包frcmod,但似乎容易报错?)。以及对于非标准可以用antecamber模块建立自己的力场,见http://ambermd.org/tutorials/basic/tutorial4b/

  3. Amber的各种模块

    准备模块

    • LEaP:
      • 创建新系统或修改现有系统的主要程序
      • 包括命令行程序tleap或GUI xleap
        1
        tleap
    • pdb4amber:
      • 因为pdb不是为amber设计的,先用pdb4amber模块转换一下
      • 看CYS有没有写成CYX,连接二硫键
        1
        2
        3
        bond <unit>.<residue #>.<atom name> <unit>.<residue #>.<atom name>
        #例:连接1,4二硫键
        bond MyUnit.1.SG MyUnit.4.SG
    • parmed:
      • 提取top文件中参数信息
      • 检查参数拓扑文件对复杂系统是否有效(见checkValidity命令)或简单修改文件
    • antechamber
      • 用通用Amber力场(GAFF)开发类药物分子或modified amino acids力场的主要程序。这些力场可以直接用于LEaP中,也可以作为进一步参数开发的起点
    • MCPB.py
      • 建立,验证金属蛋白和有机金属化合物MM(分子模拟)模型的方法
    • IPMach.py
    • paramfit
      • 拟合量子数据,生成分子键合力场参数
    • packmol-memgen

      • 处理脂质混合物,多层膜系统

      MM,模拟模块

    • sander
      • 能量最小化的主要程序,利用梯度下降法
      • 分子动力学模块利用牛顿力学
    • pmemd
      • sander的一个版本,做了运算速度合并行扫描的优化,pmemd.cuda在GPU上运行
      • 能进行Born模拟
    • mdgx
      • 包含C语言,简化力场计算的信息流
      • 可以重新设计分子动力学算法和模型
    • NAB 核酸建构

      • 用于写非周期性模拟的程序语言,用于隐式溶剂力场,替代nmode程序,见37.1节

      分析模块

    • mdout.analyzer.py
      • 提供sander/pmemd输出的信息概要
    • cpptraj
      • 主要的trajectory轨迹分析工具,cpp编写,用于叠加态计算,坐标提取,键/角/二面体值计算,原子位置波动,相关函数(描述函数相关程度),氢键分析,等
    • pytraj
      • cpptraj的python包装,结合了numpy,scipy,ipython-notebook模块
    • pbsa
      • 生物分子的溶剂介导能量学的分析,连续计算静电和非静电;支持溶剂介导的静电势可视化
    • MMPBSA.py
      • 分析动力学模拟snapshot的能量
    • FEW
      • 自由能工作流,用TI,MM/PBSA或LIE计算蛋白质与配体结合的自由能
    • amberlite
      • 分析蛋白质配体相互作用,NAB程序,python脚本
    • XtalAnalyze

      • 分析晶体模拟轨迹

      更多模块

      见1.2的List