Re: [AMBER] cpptraj, ptraj and time interval

From: Jan-Philip Gehrcke <>
Date: Fri, 20 Apr 2012 17:15:04 +0200


after having created your data file using cpptraj, it contains a 'frame
number' column and a 'value' colum, right? You now need an automatic
conversion between 'frame number' and 'time'.

I.e., for instance from

frame value
1 3.1415
2 1.3337


time/ns value
0.005 3.1415
0.010 1.3337

You can use the data file created by cpptraj and use your favourite
programming language to do this conversion. A quick&dirty Python script
doing this is attached. Maybe you can use it for your case without
modification. The modified data is written to stdout, so in order to
create a new data file with the time instead of frame number, you would
have to redirect stdout to a file, e.g.

$ python 0.002
rms_over_framenumber.dat > rms_over_time.dat

Hope this helps,


On 04/20/2012 04:25 PM, Fabrício Bracht wrote:
> Hi Liu. I read the documentation on cpptraj. The problem is that the
> {offset} mask is not exactly what I need. The thing is: my trajectory
> was written every 2ps. When cpptraj reads the trajectory (for
> instance, while doing secstruct) it writes a file that has on the x
> axis the number of frames and not the amount of ps that were
> simulated. For example, if I simulate 10000 ps saving every 2ps,
> cpptraj will write a graph from 0 to 5000. In this case, I actually
> have all 5000 frames on the graph, but it does not correspond to my
> simulation time. The offset mask will simply skip frames, not
> analysing them at all. With ptraj, when I specify the 'time' variable,
> it understands that my simulation was written every 2 ps. So in this
> case, does it mean that I will have to write a script to change the
> frame values to match my simulation time?
> Was this too confusing? I don't know if I was clear enough. Please let
> me know if I'm being too confusing.
> Thank you
> Fabrício
> 2012/4/19 Liu Denis<>:
>> Hi Fabricio:
>> Cpptraj is well documented in AmberTools 12 manual. The syntax of
>> trajin in cpptrj is similar to the one in ptraj.
>> Please refer to Page 171, I copied it here:
>> trajin<filename> [<start> [[<stop> | last] [<offset>]]] | lastframe
>> [parm<parmfile> | parmindex<#>]
>> [remdtraj remdtrajtemp<Temperature> remdout<outprefix> [netcdf]
>> trajnames<Comma-separated name list>]
>> Read in trajectory specified by filename. Currently Cpptraj will recognize
>> Amber trajectories,
>> Amber Netcdf Trajectories, Charmm DCD trajectories, Amber Restart files,
>> PDB files, and
>> TRIPOS MOL2 files. The frames to be read in can be specified with the
>> <start>,<stop>, and
>> <offset> arguments (defaults are first frame, last frame, and 1
>> respectively). If just the<start>
>> argument is given, all frames from<start> to the last frame of the
>> trjaectory will be read. To
>> read in a trajectory with offsets where the last frame # is not known,
>> specify thelast keyword
>> instead of a<stop> argument, e.g.
>> trajin Test1.crd 10 last 2
>> This will process Test1.crd from frame 10 to the last frame, skipping by 2
>> frames. To explicitly
>> select only the last frame, specify thelastframe keyword:
>> trajin Test1.crd lastframe
>> 2012/4/20 Fabrício Bracht<>
>>> Is there a way to define the time interval using cpptraj. In ptraj all
>>> you have to do is define " time<time interval> " in the config file,
>>> but I haven't found any mention about this with cpptraj.
>>> Thank you
>>> Fabrício Bracht
>>> _______________________________________________
>>> AMBER mailing list
>> --
>> ----GnuPG Public Key----
>> Key ID: 0x488C9571
>> Fingerprint: C292 D888 D713 4D13 57F0 C07D 16F3 10C9 488C 9571
>> _______________________________________________
>> AMBER mailing list
> _______________________________________________
> AMBER mailing list

AMBER mailing list

Received on Fri Apr 20 2012 - 08:30:03 PDT
Custom Search