我的问题很简单:我正在尝试编写一个 tcl 脚本来使用 $grofile 而不是每次我需要这个文件名时都编写。所以,我在 TkConsole 中所做的是:
% set grofile "file.gro"
% mol load gro ${grofile}
而且,确实,我成功上传了文件。在脚本中我有相同的行,但仍然有这个错误:
错误 #args: 应该是“set varName ?newValue?”
无法读取“grofile”:没有这样的变量
我试图解决我的问题
% set grofile [./file.gro]
我有这个错误,
无效的命令名称“./file.gro”
无法读取“grofile”:没有这样的变量
我也试过
% set grofile [file ./file.gro r]
我又遇到了第一个错误。
我还没有找到任何简单的方法来避免使用我要上传的文件的显式名称。似乎您只能使用最琐碎但乏味的方式:
mol load file.gro
mol addfile file.xtc
等等等等...
你能帮我简单解释一下为什么在 TkConsole 中我可以上传文件并将其用作变量,而我不能在 tcl 脚本中使用吗?另外,如果您知道我的错误在哪里,我将不胜感激。
如果它是基本的,我很抱歉,但我找不到任何答案。谢谢。
我添加了我的脚本的头部:
set grofile "sim.part0001_protein_lipid.gro"
set xtcfile "protein_lipid.xtc"
set intime "0-5ms"
set system "lower"
source view_change_render.tcl
source cg_bonds.tcl
mol load gro $grofile xtc ${system}_${intime}_${xtcfile}
已解决,感谢您的帮助。