ysrhhhh 发表于 2024-4-23 21:23 明显用法不对 within只能出现在选择语句里,而$oxygen_sel是个atomselect对象,后面显然不能直接接一个选择语句,根本没有这种用法 |
sobereva 发表于 2024-4-23 08:44 谢谢社长,我重新修改了一下,但还是出现了问题,以下是我修改后的文件,这次是within这里出现了报错(invalid command name),但是反复尝试了其他表示,还是没有解决,还请指点,还有修改了上次的错误部分没出现报错,但是还是没有完整运行下来,也烦请再看下是否合理 set outfile [open growthrate.dat w] set oxygen_sel [atomselect top "name OW"] #在某一帧上进行循环 set nf [molinfo top get numframes] proc analyze_frame {} { global oxygen_sel outfile set num_oxygen_atoms [$oxygen_sel num] set frame_sum 0 for {set i 0} {$i < $num_oxygen_atoms} {incr i 1} { foreach j [$oxygen_sel list] { set coordinate($j) [atomselect top "index $j"] set neighbors [ $oxygen_sel within 2.5 of $coordinate($j)] set num_neighbors [llength $neighbors] if {$num_neighbors > 1} { incr frame_sum } } } puts $outfile $frame_sum } #在每一帧上进行循环 animate goto 0 for {set i 0} {$i < $nf } {incr i} { animate goto $i analyze_frame } #关闭文件 close $outfile puts "All Done!" |
|
atomselect对象根本没有get后面跟上一个序号的用法 参考北京科音分子动力学与GROMACS培训班(http://www.keinsci.com/workshop/KGMX_content.html)的ppt了解get该怎么用:
|
手机版 Mobile version|北京科音自然科学研究中心 Beijing Kein Research Center for Natural Sciences|京公网安备 11010502035419号|计算化学公社 — 北京科音旗下高水平计算化学交流论坛 ( 京ICP备14038949号-1 )|网站地图
GMT+8, 2026-2-26 08:53 , Processed in 0.182509 second(s), 25 queries , Gzip On.