计算化学公社

标题: TCL脚本一直选不到正确的配位结构求助 [打印本页]

作者
Author:
mxq22    时间: 2025-11-19 13:19
标题: TCL脚本一直选不到正确的配位结构求助
请问各位老师,我这个tcl脚本为什么一直选不到正确的配位结构。总是会多选到不在3Å距离内的原子或者分子。脚本我要实现的目标:统计Li在3Å内配位的EC EMC PF6


# NOTE: Add pbc before used pbc wrap -compound res -all
package require pbctools
package require topotools

# -------------------------- Create output dir --------------------------
if {![file exists "coor-xyz-3A"]} {
    file mkdir "coor-xyz-3A"
}

# Set box (only once)
pbc set [list 53 53 53 90 90 90]
pbc box -on
pbc wrap -all -compound res

set sel [atomselect top "name Li"]

foreach i [$sel list]  {

    set sel2    [atomselect top "same residue as {pbwithin 3.0 of index $i}"]
    set selec   [atomselect top "name O09 and same residue as {pbwithin 3.0 of index $i}"]
        set selemc   [atomselect top "name O00 and same residue as {pbwithin 3.0 of index $i}"]
    set selpf6   [atomselect top "name F and same residue as {pbwithin 3.0 of index $i}"]

    pbc wrap -now -compound res -center com -centersel "index $i"
    set n_ec  [$selec  num]
        set n_emc  [$selemc  num]
    set n_pf6   [$selpf6  num]

    $sel2 writexyz  coor-xyz-3A/Li_PF6-${n_pf6}_EC-${n_ec}_EMC-${n_emc}_$i.xyz
    $sel2 delete
    $selec delete
        $selemc delete
    $selpf6 delete
}



作者
Author:
sobereva    时间: 2025-11-19 23:57
你都不提供结构文件,别人没法测试

此类问题,你把脚本涉及的选择语句放到representation界面里的selected atoms中把相应部分显示出来,复杂的选择语句都拆开来一点点对比测试,总能找到原因




欢迎光临 计算化学公社 (http://bbs.keinsci.com/) Powered by Discuz! X3.3