VMD 中的默认表示/绘图方法

问题描述 投票:0回答:3

在 VMD 中,我想使用绘图方法 CPK 加载每个新文件。由于某些技术原因,这似乎不是 .vmdrc 文件中的一个选项。

如何从 VMD 命令行执行此操作(以便我可以制作脚本)? 或者是否有其他解决方案/解决方法/黑客可以使这项工作正常进行?

vmd
3个回答
8
投票

有几种方法可以实现您想要的:

(1) 将以下行放入 .vmdrc 的正确位置

    mol default style CPK

(2) 使用 VMD 首选项面板(主窗口扩展菜单中的最后一项)生成满足您期望的 .vmdrc 文件。您要查找的设置位于“表示”选项卡中。

(3) 对于更高级的设置(即,当 vmd 读取启动 .vmdrc 文件时应用于已加载的分子的默认设置),您可以使用以下内容(适用于 VMD 1.9.2):

proc reset_viz {molid} {
  # operate only on existing molecules
  if {[lsearch [molinfo list] $molid] >= 0} {
    # delete all representations
    set numrep [molinfo $molid get numreps]
    for {set i 0} {$i < $numrep} {incr i} {
      mol delrep $i $molid
    }
    # add new representations
    mol representation CPK
    # add other representation stuff you want here
    mol addrep $molid
  } 
}

proc reset_viz_proxy {args} {
  foreach {fname molid rw} $args {}
  eval "after idle {reset_viz $molid}"
}

## put a trace on vmd_initialize_structure
trace variable vmd_initialize_structure w reset_viz_proxy

after idle {
  if { 1 } {
    foreach molid [molinfo list] {
      reset_viz $molid
    }
  }
}

这段代码改编自这个 Axel Kohlmeyer 网站

HTH,


0
投票

我找到了一个方便的解决方案。 在

.bashrc
中添加:

vmda () {
    echo -e "
    mol default style CPK
    user add key Control-w quit
    " > /tmp/vmdstartup
    echo "mol new $1" > /tmp/vmdcommand
    vmd -e /tmp/vmdcommand -startup /tmp/vmdstartup
}

查看结构
vmda file.pdb

并使用

Ctrl+w
关闭窗口(退出应用程序),就像其他窗口一样。


0
投票

遵循@Eiffel的第二个解决方案以及评论部分下的讨论:

@史蒂文·C·豪厄尔 说:

我保留了设置,然后才意识到虽然它不起作用 直接从命令行加载结构时,例如 $> vmd my.pdb my.dcd,打开后加载结构时它确实有效 申请。

这是你可以做的。

首先,按照@Eiffel的第二个解决方案,生成.vmdrc文件。 然后,打开 .vmdrc 文件并在部分

    # <representations>
    # state : active
    if { 1 } {
      mol default color Name
      mol default material Opaque
      mol default style CPK
      mol default selection {all}

添加

      mol representation VDW 0.200000 12.000000
      mol color Name
      mol selection {all}
      mol material Opaque
      mol addrep top
      mol selupdate 0 top 0
      mol colupdate 0 top 0
      mol scaleminmax top 0 0.000000 0.000000
      mol smoothrep top 0 0
      mol drawframes top 0 {now}
      mol clipplane center 0 0 top {0.0 0.0 0.0}
      mol clipplane color  0 0 top {0.5 0.5 0.5 }
      mol clipplane normal 0 0 top {0.0 0.0 1.0}
      mol clipplane status 0 0 top {0}
      mol clipplane center 1 0 top {0.0 0.0 0.0}
      mol clipplane color  1 0 top {0.5 0.5 0.5 }
      mol clipplane normal 1 0 top {0.0 0.0 1.0}
      mol clipplane status 1 0 top {0}
      mol clipplane center 2 0 top {0.0 0.0 0.0}
      mol clipplane color  2 0 top {0.5 0.5 0.5 }
      mol clipplane normal 2 0 top {0.0 0.0 1.0}
      mol clipplane status 2 0 top {0}
      mol clipplane center 3 0 top {0.0 0.0 0.0}
      mol clipplane color  3 0 top {0.5 0.5 0.5 }
      mol clipplane normal 3 0 top {0.0 0.0 1.0}
      mol clipplane status 3 0 top {0}
      mol clipplane center 4 0 top {0.0 0.0 0.0}
      mol clipplane color  4 0 top {0.5 0.5 0.5 }
      mol clipplane normal 4 0 top {0.0 0.0 1.0}
      mol clipplane status 4 0 top {0}
      mol clipplane center 5 0 top {0.0 0.0 0.0}
      mol clipplane color  5 0 top {0.5 0.5 0.5 }
      mol clipplane normal 5 0 top {0.0 0.0 1.0}
      mol clipplane status 5 0 top {0}

这些行将更新当前加载的分子。

如果您想进一步自定义启动配置,获取正确命令的一个技巧是首先手动设置您的表示,然后转到文件 -> 保存可视化状态,将其另存为“something.txt”。打开“something.txt”并识别重置表示的行,然后将其复制到 ~/.vmdrc 中正确位置的相应行

© www.soinside.com 2019 - 2024. All rights reserved.