2017-08-25 98 views
0

我目前做並行級聯模擬在GROMACS 4.6.5和我使用bash腳本輸入的命令:模擬用戶交互的Gromacs在擊

#!/bin/bash 
pdb2gmx -f step_04_01.pdb -o step_04_01.gro -water none -ff amber99sb -ignh 
grompp -f minim.mdp -c step_04_01.gro -p topol.top -o em.tpr 
mdrun -v -deffnm em 
grompp -f nvt.mdp -c em.gro -p topol.top -o nvt.tpr 
mdrun -v -deffnm nvt 
grompp -f md.mdp -c nvt.gro -t nvt.cpt -p topol.top -o step_04_01.tpr 
mdrun -v -deffnm step_04_01 
trjconv -s step_04_01.tpr -f step_04_01.xtc -pbc mol -o step_04_01_pbc.xtc 
g_rms -s itasser_2znh.tpr -f step_04_01_pbc.xtc -o step_04_01_rmsd.xvg 

命令如trjconvg_rms需要用戶交互來選擇選項。運行例如,當你trjconv給出:

Select group for output 
Group  0 (  System) has 6241 elements 
Group  1 (  Protein) has 6241 elements 
Group  2 (  Protein-H) has 3126 elements 
Group  3 (  C-alpha) has 394 elements 
Group  4 (  Backbone) has 1182 elements 
Group  5 (  MainChain) has 1577 elements 
Group  6 ( MainChain+Cb) has 1949 elements 
Group  7 ( MainChain+H) has 1956 elements 
Group  8 (  SideChain) has 4285 elements 
Group  9 ( SideChain-H) has 1549 elements 
Select a group: 

而且用戶有望進入如。 0進入終端選擇Group 0。我一直在使用expectsend,如嘗試:

trjconv -s step_04_01.tpr -f step_04_01.xtc -pbc mol -o step_04_01_pbc.xtc 
expect "Select group: " 
send "0" 

然而,這是行不通的。我也嘗試使用-flag,如http://www.gromacs.org/Documentation/How-tos/Using_Commands_in_Scripts#Within_Script,但它表示它不是公認的輸入。

我的expect \ send格式正確嗎?在GROMACS中有沒有另一種解決方法?

回答

1

我不知道GROMACS,但我認爲他們只是要求你使用bash的語法:

yourcomand ... <<EOF 
1st answer to a question 
2nd answer to a question 
EOF 

所以你可能有

trjconv -s step_04_01.tpr -f step_04_01.xtc -pbc mol -o step_04_01_pbc.xtc <<EOF 
0 
EOF 
+0

是這樣的作品,謝謝! – Charlietrypsin