Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux Tcl嵌套循环:错误的“args:应该是”;对于“启动测试下一个命令”;_Linux_Unix_Tcl_Vmd - Fatal编程技术网

Linux Tcl嵌套循环:错误的“args:应该是”;对于“启动测试下一个命令”;

Linux Tcl嵌套循环:错误的“args:应该是”;对于“启动测试下一个命令”;,linux,unix,tcl,vmd,Linux,Unix,Tcl,Vmd,我正在尝试执行嵌套循环,但收到错误消息“error#args:should”是“for start test next command”。这意味着什么,有人能帮我找出代码的错误吗 注意:我正在运行虚拟分子动力学(VMD)中的代码,因此它包含一些特定于程序的术语,如resid和mol。请忽略这些 #count water molecules between chain A and chain C or between #chain B and chain C set input_file [o

我正在尝试执行嵌套循环,但收到错误消息“error#args:should”是“for start test next command”。这意味着什么,有人能帮我找出代码的错误吗

注意:我正在运行虚拟分子动力学(VMD)中的代码,因此它包含一些特定于程序的术语,如resid和mol。请忽略这些

#count water molecules between chain A and chain C or between #chain B and chain C


set input_file [open ./name_3_pdb_chain_renamed.dat r]

set data [read $input_file]
set data [split $data "\n"]
close $input_file

set chain_list [lindex $data 0]

cd 7_count_water

set outfile [open count_water3.dat w]


set chain_compare ""

set pdblen [llength $chain_list]

for {set i 0} {$i<$pdblen} {incr i} 
{
set pid [lindex [lindex $chain_list $i] 0]

set len [llength [lindex $chain_list $i]]

mol load pdb ../2_chain_rename/${pid}_chain_revised.pdb


mol modstyle 0 top NewCartoon



if {$len==4} {
    set chain_compare [lappend chain_compare $pid]
}

set 11 [atomselect top all]

set mid [$11 molid]

mol delete $mid
}




set lll [llength $chain_compare]

for {set j 0} {$j< $lll} {incr j} 
{

set pid [lindex $chain_compare $j]

mol load pdb ../2_chain_rename/${pid}_chain_revised.pdb

set 11 [atomselect top "chain A and name CA"]

set res_len [llength [$11 get resid]]

set res_id [$11 get resid]

#residue length for chain C
set ag [atomselect top "chain C and name CA"]
set ag_len [llength [$al get resid]]
set ag_id [$al get resid]


#loop water between chain A and chain C
for {set k 0} {$k<$res_len} {incr k} 
{

    set water_around_a [atomselect top "{resname HOH and {within 5.0 of {chain A and resid [lindex $res_id $k]} and {within 5.0 of chain C}}} "]


    set water_around_a_resid [$water_around_a get resid]
    set water_around_a_resname [$water_around_a get resname]

    #loop antigen residues around water
    for {set g 0} {$g < ag_len} {incr g} 
    {

        set ag_around_water [atomselect top "{chain C and {resid [lindex $res_id $g] and {within 5.0 of $water_around_a}}} "]

        set ag_around_water resid [$ag_around_water get resid]

        set ag_around_water_resname [$ag_around_water get resname]


        puts $outfile "$pid [lindex $res_id $k] [lindex [$11 get resname] $k] $ag_around_water_resname A: $water_around_a_resname"
    }
}



set 11 [atomselect top "chain B and name CA"]

set res_len [llength [$b11 get resid]]

set res_id [$b11 get resid]

#residue length for chain C
set ag [atomselect top "chain C and name CA"]
set ag_len [llength [$al get resid]]
set ag_id [$al get resid]

for {set k 0} {$k<$res_len} {incr k} 
{


set water_around_b [atomselect top "{resname HOH and {within 5.0 of {chain B and resid [lindex $res_id $k]} and {within 5.0 of chain C}}} "]

set water_around_b_resid [$water_around_b get resid]
set water_around_b_resname [$water_around_b get resname]

#loop antigen residues around water
for {set g 0} {$g < ag_len} {incr g} 
{

    set ag_around_water [atomselect top "{chain C and {resid [lindex $res_id $g] and {within 5.0 of $water_around_b}}} "]

    set ag_around_water resid [$ag_around_water get resid]

    set ag_around_water_resname [$ag_around_water get resname]

    puts $outfile "$pid [lindex $res_id $k] [lindex [$11 get resname] $k] $ag_around_water_resname A: $water_around_b_resname"


    }

}

}


close $outfile

cd ..
#计算链A和链C之间或链B和链C之间的水分子
设置输入文件[打开。/name\u 3\u pdb\u chain\u重命名为.dat r]
设置数据[读取$input\u文件]
设置数据[拆分$data”\n“]
关闭$input\u文件
设置链列表[lindex$data 0]
cd 7\u计数\u水
设置输出文件[未清计数\u水3.dat w]
设置链\u比较“”
设置pdblen[L长度$chain_列表]

对于{seti0}{$i您需要在同一行上启动for循环的主体。主体的第一个卷曲需要在下一个命令之后

for {set i 0} {$i < 10} {incr i} {
  puts $i
}
对于{set i 0}{$i<10}{incr i}{
投入$i
}

Nevermind,问题解决了。意识到我不能将for循环的开始括号放在单独的行上新行真的很重要,因为它们在默认情况下标志着命令的结束…