请选择 进入手机版 | 继续访问电脑版

分子模拟论坛 Molecular Simulation Forums

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 431|回复: 4

A short vmd script for solvating 1AFO.pdb

[复制链接]

37

主题

199

帖子

441

积分

中级会员

Rank: 3Rank: 3

积分
441
发表于 2009-2-12 08:23:00 | 显示全部楼层 |阅读模式
#1AFO.pdb is required for running this script;you can easily retrieve it from www.pdb.org
set work_directory "the directory where 1AFO.pdb is located";
#otherwise the current directory is used;
set prefix protein;
set temp_pdb afo_temp;
set final_pdb system;
package require psfgen
package require solvate
package require autoionize
package require autopsf
if {[file isdirectory ${work_directory}]} {cd ${work_directory}};
#1AFO.pdb comprises of 20 frames, we might only need the last frame;
mol load pdb 1AFO.pdb;
autopsf -protein -mol top -prefix ${prefix};
mol delete all;
#if you need to add lipid bilayer, your can insert you own script here;
#I have posted a vmd script in this thread: http://www.mdbbs.org/thread-8762-1-1.html
#solvate the protein, and ionize the system
mol load psf ${prefix}.psf pdb ${prefix}.pdb;
set sel [atomselect top all];
#might be better to use "lipids" instead of "all" if you have lipid bilayer in the system
set geometric_center [measure center $sel];#get the geometric center of the protein
set lower_limit [vecadd ${geometric_center} "-30.0 -30.0 -30.0"];#get the border of the box
set upper_limit [vecadd ${geometric_center} "30.0 30.0 30.0"];
solvate ${prefix}.psf ${prefix}.pdb -o ${temp_pdb} -s WT -minmax [list ${lower_limit} ${upper_limit}];
autoionize -psf ${temp_pdb}.psf -pdb ${temp_pdb}.pdb -is 0.30 -o ${final_pdb};
#delete unwanted files, only works on Unix or Linux based systems
eval exec rm [glob ${temp_pdb}*]
eval exec rm [glob ${prefix}*]
eval exec rm [glob combine.p*]
exit;
#quit VMD
回复

使用道具 举报

37

主题

199

帖子

441

积分

中级会员

Rank: 3Rank: 3

积分
441
 楼主| 发表于 2009-2-12 08:24:00 | 显示全部楼层
set output min1;
set input system;
set frequency 100;
# input
structure${input}.psf;
coordinates${input}.pdb;
temperature0;
binaryoutputyes;
binaryrestartyes;
restartfreq${frequency};
restartname${output};
paraTypeCharmmon;
parameterspar_all27_prot_lipid.prm;
# force field parameters
excludescaled1-4;
1-4scaling1.0;
cutoff12.0;
switchingOn;
switchdist10;
pairlistdist14;
# integrator params
timestep1;
nonbondedFreq2;
fullElectFrequency4;
stepspercycle20;
# Periodic boundary condition
if {1} {
cellBasisVector160 0 0
cellBasisVector20 60 0
cellBasisVector30 0 60
cellorigin0.0 -1.0 1.0
wrapWateron
wrapAllon
wrapNeareston
# Particle Mesh Ewald
PMEyes
PMEGridSpacing1
}
# output
outputname${output};
dcdfile${output}.dcd;
dcdfreq${frequency};
outputEnergies${frequency};
minimize1000;
回复

使用道具 举报

37

主题

199

帖子

441

积分

中级会员

Rank: 3Rank: 3

积分
441
 楼主| 发表于 2009-2-12 08:26:00 | 显示全部楼层
2楼是个namd configuration文件,可以用来对1楼文件产生的system.psf/pdb进行能量最小化。
不是抄袭的代码,呵呵。
回复

使用道具 举报

173

主题

2919

帖子

6017

积分

论坛元老

Rank: 8Rank: 8

积分
6017
发表于 2009-2-12 09:56:00 | 显示全部楼层
我这里也有几个脚本,还没有测试过。
The following script illustrates how psfgen and VMD can be used together to addater around a protein structure. It assumes you already have a psf and pdb file for your protein, as well as a box of water which is large enough to contain the protein. For more information on how atomselections can be used within VMD scripts, see the VMD User’s Guide.
proc addwater { psffile pdbfile watpsf watpdb } {
# Create psf/pdb files that contain both our protein as well as
# a box of equilibrated water. The water box should be large enough
# to easily contain our protein.
resetpsf
readpsf $psffile
readpsf $watpsf
coordpdb $pdbfile
coordpdb $watpdb
# Load the combined structure into VMD
writepsf combine.psf
writepdb combine.pdb
mol load psf combine.psf pdb combine.pdb
# Assume that the segid of the water in watpsf is QQQ
# We want to delete waters outside of a box ten Angstroms
# bigger than the extent of the protein.
set protein [atomselect top "not segid QQQ"]
set minmax [measure minmax $protein]
foreach {min max} $minmax { break }
foreach {xmin ymin zmin} $min { break }
foreach {xmax ymax zmax} $max { break }
set xmin [expr $xmin - 10]
set ymin [expr $ymin - 10]
set zmin [expr $zmin - 10]
set xmax [expr $xmax + 10]
set ymax [expr $ymax + 10]
set zmax [expr $zmax + 10]
# Center the water on the protein. Also update the coordinates held
# by psfgen.
set wat [atomselect top "segid QQQ"]
$wat moveby [vecsub [measure center $protein] [measure center $wat]]
foreach atom [$wat get {segid resid name x y z}] {
foreach {segid resid name x y z} $atom { break }
coord $segid $resid $name [list $x $y $z]
}
# Select waters that we don’t want in the final structure.
et outsidebox [atomselect top "segid QQQ and (x = $xmax or y >= $ymax or z >= $xmax)"]
set overlap [atomselect top "segid QQQ and within 2.4 of (not segid QQQ)"]
# Get a list of all the residues that are in the two selections, and delete
# those residues from the structure.
set reslist [concat [$outsidebox get resid] [$overlap get resid]]
set reslist [lsort -unique -integer $reslist]
foreach resid $reslist {
delatom QQQ $resid
}
# That should do it - write out the new psf and pdb file.
writepsf solvate.psf
writepdb solvate.pdb
# Delete the combined water/protein molecule and load the system that
# has excess water removed.
mol delete top
mol load psf solvate.psf pdb solvate.pdb
# Return the size of the water box
return [list [list $xmin $ymin $zmin] [list $xmax $ymax $zmax]]
}
回复

使用道具 举报

173

主题

2919

帖子

6017

积分

论坛元老

Rank: 8Rank: 8

积分
6017
发表于 2009-2-12 09:57:00 | 显示全部楼层
另一个
### Script to immerse ubiquitin in a sphere of water just large enough
### to cover it
set molname ubq
mol new ${molname}.psf
mol addfile ${molname}.pdb
### Determine the center of mass of the molecule and store the coordinates
set cen [measure center [atomselect top all] weight mass]
set x1 [lindex $cen 0]
set y1 [lindex $cen 1]
set z1 [lindex $cen 2]
set max 0
### Determine the distance of the farthest atom from the center of mass
foreach atom [[atomselect top all] get index] {
set pos [lindex [[atomselect top "index $atom"] get {x y z}] 0]
set x2 [lindex $pos 0]
set y2 [lindex $pos 1]
set z2 [lindex $pos 2]
set dist [expr pow(($x2-$x1)*($x2-$x1) + ($y2-$y1)*($y2-$y1) +
($z2-$z1)*($z2-$z1),0.5)]
if {$dist > $max} {set max $dist}
}
mol delete top
### Solvate the molecule in a water box with enough padding (15 A).
### One could alternatively align the molecule such that the vector
### from the center of mass to the farthest atom is aligned with an axis,
### and then use no padding
package require solvate
solvate ${molname}.psf ${molname}.pdb -t 15 -o del_water
resetpsf
package require psfgen
mol new del_water.psf
mol addfile del_water.pdb
readpsf del_water.psf
coordpdb del_water.pdb
### Determine which water molecules need to be deleted and use a for loop
### to delete them
set wat [atomselect top "same residue as {water and ((x-$x1)*(x-$x1) +
(y-$y1)*(y-$y1) + (z-$z1)*(z-$z1))
同linux 下完全一样。
是不是vmd 在windows 安装的时候也安装了linux 的rm 等程序呢,毕竟windows 下删除文件和目录用的是不同的命令
而(在windows下)用
eval exec delete filename 可以,但文件名不能有通配符。

file delete filename 也可以,但同样不能用通配符。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|分子模拟论坛

GMT+8, 2020-7-3 02:38 , Processed in 0.055229 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表