Re: [AMBER] Error with a cpptraj loop

From: Daniel Roe via AMBER <amber.ambermd.org>
Date: Sun, 1 Oct 2023 20:31:41 -0400

Hi,

You were close!. The command for closing out a loop block is 'done',
not 'do'. However, I wouldn't go about it this way since with 'trajin'
+ 'trajout onlyframes' you will be reading the entire input trajectory
each time. Here is a script that will extract all the frames from a
trajectory using trajin (so you will only read the single frame you
want to process) and write them out as single trajectories:

parm ../tz2.parm7
trajin ../tz2.nc
# Set N to the total number of frames in the trajectory
set N = trajinframes
for i=1;i<=$N;i++
  # Clear the previous trajectory
  clear trajin
  # Read in a single frame
  trajin ../tz2.nc $i $i
  # Write it out
  trajout temp.$i.nc
  # Run
  run
done

Hope this helps,

-Dan

On Sun, Oct 1, 2023 at 3:57 PM VERONICA MARTIN HERNANDEZ via AMBER
<amber.ambermd.org> wrote:
>
> Hi everyone again (and sorry for writting to much)
>
> I've to extract all the frames of a dynamic in separated files and I was trying with cpptraj and the following loop:
>
> parm CRBN-LVR-solv.prmtop
> trajin CRBN-LVR-NVTcenter.mdcrd
> for iFrame in {1..500}
> trajout CRBN-LVR-\$iFrame.mdcrd onlyframes \$iFrame
> do
> run
>
> But I get the following error:
>
> INPUT: Reading input from 'extract.in'
> [parm CRBN-LVR-solv.prmtop]
> Reading 'CRBN-LVR-solv.prmtop' as Amber Topology
> Radius Set: H(N)-modified Bondi radii (mbondi2)
> [trajin CRBN-LVR-NVTcenter.mdcrd]
> Reading 'CRBN-LVR-NVTcenter.mdcrd' as Amber Trajectory
> [for iFrame in {1..500}]
> Setting up 'for' loop.
> CONTROL: Parsing control block.
> BLOCK 0: for ((iFrame in {1..500})) do
> [trajout CRBN-LVR-\$iFrame.mdcrd onlyframes \$iFrame]
> Added command 'trajout' to control block 0.
> [do]
> Added command 'do' to control block 0.
> Error: 1 unterminated control block(s) detected.
> Error: 0 : for ((iFrame in {1..500})) do
> TIME: Total execution time: 0.1296 seconds.
> Error: Error(s) occurred during execution.
>
> How can I fix it?
> Thanks in advance
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber

_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Sun Oct 01 2023 - 18:00:02 PDT
Custom Search