Re: [AMBER] Query regarding density analysis in CPPTRAJ. Raising this issue again.

From: Daniel Roe <>
Date: Tue, 11 May 2021 15:09:03 -0400


You might be able to get what you want with a for loop. Something like:

set masks = '":PC.P31" ":PC.N31" ":PC.C2" ":PC | :OL | :OL2"'
set del = 'delta 0.25'
set out1 = number_density.dat
parm ../DOPC.parm7
trajin ../DOPC.rst7
# Set MAX to the current number of frames
set MAX = trajinframes
# Clear the trajectory
clear trajin
# Loop over each frame individually, calculate density
for i=1;i<=$MAX;i++
  # Load only the desired frame
  trajin ../DOPC.rst7 $i $i
  center ":PC | :OL | :OL2" origin
  density out $out1.$i number $del $masks name frame.$i
  # Clear that frame
  clear trajin

Hope this helps,


On Tue, May 11, 2021 at 2:03 PM ARITRA MITRA <> wrote:
> Dear Amber Users,
> This query is regarding the 'density' analysis in CPPTRAJ. I am running the following script in order to obtain the density distribution of water as a function of box length in the x direction.
> parm abc.prmtop
> trajin abc.crd
> density out wat-density-x.dat name x-axis-wat delta 0.1 x mass :WAT
> The output file contains the density values averaged over the entire trajectory (along with the standard deviation values) . For the purpose of my analysis, I wish to calculate the
> density values per frame such that in addition
> to the box length and density data the time information will also be written out. I need a workaround to bypass the time average feature of the 'density' keyword. Any suggestion on this
> topic is highly appreciated.
> Thanks in advance.
> Regards,
> Aritra Mitra,
> Senior Research Fellow,
> Prof. Sandip Paul's Group,
> Department of Chemistry,
> IIT Guwahati.
> _______________________________________________
> AMBER mailing list

AMBER mailing list
Received on Tue May 11 2021 - 12:30:02 PDT
Custom Search