|
本帖最后由 tjuptz 于 2019-5-13 22:28 编辑
前些天有同学问能不能帮忙建gyroid形的多空材料,用于吸附研究。一开始以为是在特殊区域内填充,所以想的是用packmol搭建。但是packmol不支持gyroid那种三角函数形式。后来想到这种无机材料用VMD在基体上挖空就好了。所以在学习社长的一些脚本基础上写了个脚本,定义了一个carve命令,通过这个命令,以及控制参数就可挖不同孔洞出来。脚本内容如下:- #第一部分是作图设定
- color Display Background white
- display rendermode GLSL
- display depthcue off
- display projection Orthographic
- #第二部分是打开文件并设定显示风格
- mol new 1.pdb
- pbc box
- mol modstyle 0 top VDW 1.000000 12.000000
- #这个是用法提示
- puts "Use like 'carve 1.42 90 90 90'. The value after 'carve' is the threshold between 0 and 1.5 and size of model(90 default)!"
- puts "The model carved would be saved automatically as 2.pdb!"
- #实际选区。因为用到的1.pdb是MS产生的,几何中心不在原点,所以先挪到原点。切完再挪回去。原方程的周期是1,所以用边长abc进行归一化处理,这里手动输入,默认值为90(因为我用的就是90)
- proc carve {val {a 90} {b 90} {c 90}} {
- global M_PI
- set sel [atomselect top all]
- set vec [measure center $sel]
- $sel moveby [vecinvert $vec]
- set range "not abs{sin(2*$M_PI*x/$a)*cos(2*$M_PI*y/$b)+sin(2*$M_PI*y/$b)*cos(2*$M_PI*z/$c)+sin(2*$M_PI*z/$c)*cos(2*$M_PI*x/$a)}<=$val"
- mol modselect 0 top $range
- set model [atomselect top $range]
- $sel moveby $vec
- $model writepdb 2.pdb
- }
复制代码
切完除了窗口显示以外,会自动保存到VMD自动目录下为2.pdb。效果就和下面这个图差不多。太懒了,没截图,谷歌搜的一张。
gyroid
carve.tcl
(767 Bytes, 下载次数 Times of downloads: 14)
|
评分 Rate
-
查看全部评分 View all ratings
|