I am Using AMBER to simulation molecular system. In AMBER there is a module to analyse data called "cpptraj".
Normally I use the command in bash script as below:
#!/bin/bash
path="../Production-from-gpu"
system="maltoLyo-23per"
top="maltoLyo23per.top"
alltraj="md-product.center.reimage-all.traj"
outtraj="maltoLyo-23per-reimage"
cpptraj $top << EOF
trajin ../$system-MD001-run0100.traj 1 100 5
trajin ../$system-MD001-run0200.traj 1 100 5
trajin ../$system-MD001-run0300.traj 1 100 5
trajin ../$system-MD001-run0400.traj 1 100 5
trajin ../$system-MD001-run0500.traj 1 100 5
trajin ../$system-MD001-run0600.traj 1 100 5
trajin ../$system-MD001-run0700.traj 1 100 5
trajin ../$system-MD001-run0800.traj 1 100 5
trajin ../$system-MD001-run0900.traj 1 100 5
trajin ../$system-MD001-run1000.traj 1 100 5
trajout abc.traj mdcrd
EOF
I find no problem running this script.
Now I want to use "for" loop in this script, like,
#!/bin/bash
path="../Production-from-gpu"
system="maltoLyo-23per"
top="maltoLyo23per.top"
alltraj="md-product.center.reimage-all.nc"
outtraj="maltoLyo-23per-reimage"
cpptraj $top << EOF
for i in {0..5};do
if [[ ($i -ge 0) && ($i -lt 10) ]]; then
trajin $path/$system-MD00i-run0100.traj 1 100 5
trajin $path/$system-MD00i-run0200.traj 1 100 5
trajin $path/$system-MD00i-run0300.traj 1 100 5
trajin $path/$system-MD00i-run0400.traj 1 100 5
trajin $path/$system-MD00i-run0500.traj 1 100 5
trajin $path/$system-MD00i-run0600.traj 1 100 5
trajin $path/$system-MD00i-run0700.traj 1 100 5
trajin $path/$system-MD00i-run0800.traj 1 100 5
trajin $path/$system-MD00i-run0900.traj 1 100 5
trajin $path/$system-MD00i-run1000.traj 1 100 5
fi
trajout abc.traj mdcrd
##############################################
done
EOF
I find this code can not be executed. I get error message like:
vijay@glycosim:/media/glycoExtra/TRAJECTORY-lyotropic-system300ns/maltoLyo-C12-23per/Select-traj-using-cpptraj$ ./generate_traj_select_script.sh
CPPTRAJ: Trajectory Analysis. V13.15
___ ___ ___ ___
| \/ | \/ | \/ |
_|_/\_|_/\_|_/\_|_
AmberParm Title: [default_name]
Radius Set: modified Bondi radii (mbondi)
INPUT: Reading Input from STDIN
[for i in {0..5};do]
[for]: Command not found.
vijay@glycosim:/media/glycoExtra/TRAJECTORY-lyotropic-system300ns/maltoLyo-C12-23per/Select-traj-using-cpptraj$
How I can make this script to run without problem? Appreciate any help in advance. Thank you.
fortocpptraj?