计算化学公社

 找回密码 Forget password
 注册 Register
Views: 1557|回复 Reply: 2
打印 Print 上一主题 Last thread 下一主题 Next thread

[VMD] VMD选择一定区域内逐帧原子个数脚本输出总为整个体系总原子数,如何解决。

[复制链接 Copy URL]

60

帖子

0

威望

342

eV
积分
402

Level 3 能力者

本帖最后由 cgy 于 2024-7-7 11:48 编辑

各位老师好,本人新手,在使用VMD进行可视化分析时,想要求x>0 and x<50 and y>0 and y<50 and z>130 and z<150区域的逐帧原子数,学习一段时间VMD脚本语言后,自行编写了一段脚本,尝试进行输出我所需要的区域的原子数,结果最后输出为全部总数原子,请问各位老师我写的脚本存在什么问题,谢谢老师。在无选定的区域上的原子数是由0逐渐到四千多个分子,而不是体系总分子数10290。
mol new {md.trr} type {trr} waitfor all
for {set i 0} {$i <= 201} {incr i} {
    set sel [atomselect top "x > 0 and x < 50 and y > 0 and y < 50 and z > 130 and z < 150"]
    animate goto $i
    set num_atoms [molinfo top get numatoms]
    puts "Frame $i: $num_atoms atoms"
}

md.gro和md.trr文件压缩后还32MB上传不了,就附上VMD输入脚本后的计数错误的截图。是在VMD打开md.trr文件后输入的脚本。谢谢各位老师了。


202407071141226386..png (84.06 KB, 下载次数 Times of downloads: 26)

202407071141226386..png

496

帖子

11

威望

4291

eV
积分
5007

Level 6 (一方通行)

2#
发表于 Post on 2024-7-8 09:26:24 | 只看该作者 Only view this author
animate goto $i
改为:
$sel frame $i
$sel update
把set sel [atomselect top "x > 0 and x < 50 and y > 0 and y < 50 and z > 130 and z < 150"]挪到for循环外面去

评分 Rate

参与人数
Participants 1
eV +4 收起 理由
Reason
cgy + 4 我很赞同

查看全部评分 View all ratings

自由发挥,野蛮生长

60

帖子

0

威望

342

eV
积分
402

Level 3 能力者

3#
 楼主 Author| 发表于 Post on 2024-7-8 10:18:38 | 只看该作者 Only view this author
丁越 发表于 2024-7-8 09:26
animate goto $i
改为:
$sel frame $i

set sel [atomselect top "water and x > 0 and x < 50 and y > 0 and y < 50 and z > 130 and z < 150"]
for {set i 0} {$i <= 201} {incr i} {
    $sel frame $i
    $sel update
puts "Frame $i: [expr [$sel num]]"
}
您好,经过您的指导,和http://bbs.keinsci.com/forum.php ... A%D0%C4%BE%E0%C0%EB这一篇的输出结果的语句参考,已经解决问题,最终输出了该区域的逐帧分子数,再次感谢您!

评分 Rate

参与人数
Participants 1
eV +3 收起 理由
Reason
ptj + 3 谢谢

查看全部评分 View all ratings

本版积分规则 Credits rule

手机版 Mobile version|北京科音自然科学研究中心 Beijing Kein Research Center for Natural Sciences|京公网安备 11010502035419号|计算化学公社 — 北京科音旗下高水平计算化学交流论坛 ( 京ICP备14038949号-1 )|网站地图

GMT+8, 2026-2-28 02:26 , Processed in 0.180023 second(s), 24 queries , Gzip On.

快速回复 返回顶部 返回列表 Return to list