vmd基本操作

打开程序

1
2
3
4
5
6
7
vmd -dispdev text -e file.tcl     # vmd without GUI

vmd file.pdb # 打开pdb

vmd -parm7 test.prmtop -crdbox test.mdcrd -dispdev text -e test.tcl # vmd查看 amber的轨迹

vmd -parm7 com_solvated.prmtop -netcdf equil.mdcrd.nc # (mdcrd文件如果后缀改为.nc 则不需要 -netcdf选项直接放文件也行) netcdf格式(不支持win系统):

GUI

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
under "Selected Atoms" enter "all within 5 of resname TRP"    # 选择5A以内的原子

键盘 r, t, s 分别代表rotate translate scale

改变旋转的中心
Next click on the Mouse menu in the "VMD Main" window and click "center". This allows us to change the center of rotation. Now click on the backbone nitrogen of the tryptophan. Now when you rotate it should rotate about this atom. (Press r to return to rotate mode).


rmsd calculation

residue 1 to 50 # 按残基编号来选中残基

drawing method # 里面可以选择氢键

mouse > label # 可以用来选择原子,测定距离,同事可以用graphics > labels 进行查看

visual > movie making # 可以用来制作movie

Tk console

导入分子

1
2
3
4
5
6
7
8
mol new ../ionized.pdb type pdb waitfor all   

mol addfile file.pdb

mol load parm7 parm.file rst7 crd.file # Amber
mol load psf psf.file pdb pdb.file # namd

mol delete all

选择指定部分

1
2
3
set sel [atomselect top "chain A"]              # all, protein, lipid

$sel writepdb file.pdb

循环,输出数据到文件中

1
2
3
4
5
6
7
set file [open in.ind w]
foreach indices [$sel get index] {
puts $file "$indices"
}

# flush $file
close $file

Get the unit cell parameters

1
2
3
4
5
package require pbctools
#get the x, y, z lengths of Solvation box
set xLen [lindex [lindex [pbc get -now] 0] 0]
set yLen [lindex [lindex [pbc get -now] 0] 1]
set zLen [lindex [lindex [pbc get -now] 0] 2]

保存部分结构的轨迹

Single dcd

  1. 首先制作index文件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    set filename "1chain_A_wt"

    #mol new ionized.pdb type pdb waitfor all
    # set sel [atomselect top "((resid >=1 and resid <=28) or (resid >=134 and resid <=140)) and name P"]
    set sel [atomselect top "chain A"]
    # set indices [$sel get index]

    set file [open $filename.ind w]
    foreach indices [$sel get index] {
    puts $file "$indices"
    }

    # flush $file
    close $file
  2. 在Tk console中直接输入或者保存为getind.tcl,然后source getind.tcl.

  3. 然后使用 catdcd
    1
    catdcd -o output.dcd -i index.ind trajectory.dcd

Multiple dcd

1
2
3
4
5
6
7
8
9
10
11
foreach i {A B C D E F G H I J K L M N O P Q R S T U V W X} {

set filename "1chain+$i+wt"
set sel [atomselect top "chain $i"]
set file [open $filename.ind w]

foreach indices [$sel get index] {
puts $file "$indices"
}
close $file
}
1
2
3
4
5
#!/bin/bash
for i in A B C D E F G H I J K L M N O P Q R S T U V W X
do
catdcd -o 1chain+$i+wt.dcd -i 1chain+$i+wt.ind NPT-4.dcd
done

如果保存为.xyz

1
2
3
4
5
6
#!/bin/bash
for i in {1..24}
do
catdcd -o 1chain+P$i+wt+CA+dcd.xyz -otype xyz -i 1chain+P$i+wt+CA.ind -stype pdb -s MjHSP16.5_wt_CA.pdb -first 4050 -last 4500 NPT-4_CA.dcd
catdcd -o 1chain+P$i+wt+CA+ref.xyz -otype xyz -i 1chain+P$i+wt+CA.ind -stype pdb -s MjHSP16.5_wt_CA.pdb -first 4050 -last 4050 NPT-4_CA.dcd
done

将二进制的DCD 转换为 xyz

1
2
3
catdcd -o output.xyz -otype xyz -s struct.psf -stype psf somedcd.dcd
or
catdcd -o output.xyz -otype xyz -s struct.pdb -stype pdb somedcd.dcd