我正在一个集群计算系统上运行以下slurm脚本。
#!/bin/bash
#
#SBATCH --job-name=R1.5-CG-nvtrun # create a short name for your job
#SBATCH --qos=short # _quality of service_
#SBATCH --nodes=1 # node count
#SBATCH --ntasks-per-node=12 # number of tasks per node
#SBATCH --cpus-per-task=1 # cpu-cores per task (>1 if multi-threaded tasks)
#SBATCH --mem=10GB # total memory requested
##SBATCH --mem-per-cpu=4G # memory per cpu-core (4G per cpu-core is default)
#SBATCH --gres=gpu:1 # number of gpurs per node
#SBATCH --time=7:00:00 # total run time limit (HH:MM:SS)
#SBATCH --mail-type=all # send email on job start, end, and fail
# The modules I need to run my job
module purge
module load intel/19.0/64/19.0.5.281 # for running gromacs
module load anaconda3/2020.7
conda activate data-analysis
# run the job
set -e
# keep track of the last executed command
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
# echo an error message before exiting
trap 'echo "\"${last_command\" command filed with exit code $?."' EXIT
init=InitializeSystem
em=EnMinimization
nvt=NVT-Equilibration
npt=NPT-Equilibration
md=MolDynamics
for iteration in {1..5}
do
echo "iteration number $iteration"
echo "setting up editconf..."
# construct a box using editconf
gmx editconf -f ./${init}/BZCG.gro -o ./${init}/BZCG-in-box.gro -c -d 1.0 -bt cubic > ./${init}/editconf.txt 2>&1
echo "executed editconf!"
echo "setting up insert molecules..."
# insert 1000 molecules in a box
gmx insert-molecules -box 4.48 4.48 4.48 -ci ./${init}/BZCG-in-box.gro -nmol 600 -o ./${init}/BZCG-setup.gro > ./${init}/insert-molecules1.txt 2>&1
echo "executed insert molecules!"
echo "setting up grommp for em..."
# run a minimization script
gmx grompp -f ./${em}/minim.mdp -c ./${init}/BZCG-setup.gro -p ./${init}/topol.top -o ./${em}/BZCG-EnMinimized > ./${em}/grompp_em.txt 2>&1
echo "executed grommp em!"
echo "setting up mdrun for em..."
# run the molecular dynamics
gmx mdrun -v -deffnm ./${em}/BZCG-EnMinimized > ./${em}/mdrun_em.txt 2>&1
echo "executed mdrun for em!"
echo "setting up grommp for nvt..."
# run an NVT script
gmx grompp -f ./${nvt}/nvt.mdp -c ./${em}/BZCG-EnMinimized.gro -r ./${em}/BZCG-EnMinimized.gro -p ./${init}/topol.top -o ./${nvt}/BZCG-NVT-Eqbrt.tpr > ./${nvt}/grompp_nvt.txt 2>&1
echo "executed grommp for nvt!"
echo "setting up mdrun for nvt..."
# run the molecular dynamics
gmx mdrun -v -deffnm ./${nvt}/BZCG-NVT-Eqbrt > ./${nvt}/mdrun_nvt.txt 2>&1
echo "executed mdrun for nvt!"
echo "moving onto production..."
# run the production script
echo "setting up grommp for production run..."
gmx grompp -f ./${md}/md.mdp -c ./${nvt}/BZCG-NVT-Eqbrt.gro -t ./${nvt}/BZCG-NVT-Eqbrt.cpt -p ./${init}/topol.top -o ./${md}/BZCG-MolDynamics.tpr -maxwarn 1 > ./${md}/grompp_production.txt 2>&1
echo "executed grommp for production run!"
echo "setting up mdrun for production run..."
# run the molecular dynamics
gmx mdrun -v -deffnm ./${md}/BZCG-MolDynamics > ./${md}/mdrun_production.txt 2>&1
echo "executed production run!"
echo "start creating the rdf..."
gmx rdf -f ./${md}/BZCG-MolDynamics.xtc -s ./${md}/BZCG-MolDynamics.tpr -o rdf_.xvg -selrpos whole_mol_com -seltype whole_mol_com -cut 0 -rmax 2.226 << EOF
2
2
EOF
echo "rdf created!"
echo "deleting back-ups..."
for dir in ${init} ${em} ${nvt} ${npt} ${md}
do
rm ./$dir/\#* || true
done
rm \#* || true
echo "deleted back-ups!"
# run the analysis, update parameters
python update.py
done
我正在运行的所有gmx
工具都是一个名为gromacs的软件包。
这个脚本的奇怪之处在于它按预期运行所有东西,它执行10次迭代,但是一旦这些迭代完成,它就输出一条错误消息:/var/spool/slurmd/job6141167/slurm_script: exit trap: line 1: unexpected EOF while looking for matching `"'
第1行怎么会有不匹配的"
?
下面没有缩进的EOF
2
2
似乎是程序完成我想要做的工作的唯一方法。如果我取消了EOF的缩进,就会得到以下错误:
/var/spool/slurmd/job6141905/slurm_script: line 104: warning: here-document at line 84 delimited by end-of-file (wanted `EOF')
/var/spool/slurmd/job6141905/slurm_script: line 105: syntax error: unexpected end of file
/var/spool/slurmd/job6141905/slurm_script: exit trap: line 1: unexpected EOF while looking for matching `"'
这里错误的本质是什么,我如何修复它?如果你对我有任何建议,我将不胜感激。
发布于 2021-03-19 07:15:30
您在行中缺少一个}
trap 'echo "\"${last_command\" command filed with exit code $?."' EXIT
^
这可能是引发这一错误的原因。
https://stackoverflow.com/questions/66697836
复制相似问题