Calculate mean residence time of water in MD simulation with AMBERTOOLS. Part2

I tested several times. The two steps in Part1 can be combined in one step. The new cpptraj script is below.

##########mask.in###########

trajin md.mdcrd

autoimage

mask “((:1-100&!@H=)<:4.0&:WAT&!@H=)” maskout water.dat

##########################

And I made a simple script to calculate the distribution of residence time. I chose a 1ns trajectory (1ps/frame) as an example. After running the BASH script, the number of water molecule at each time range (10ps in the example) will be saved to dist_water.dat.

./count.sh water.pdb

###########count.sh############################

sed -i /Frame/d $1
a=(`cat $1 | cut -c 36- | sort -n | uniq -c | sort -nr -k1 | cut -c -7`)
name=`echo $1 | cut -f1 -d"."`
for ((i=0;i<${#a[*]};i++));do
((c=${a[$i]}))
for j in {1..1000..10};do #use 10ps as a bin
((k=$j+10))
if (( $c >= $j )) && (( $c < $k )); then ((b[$j]++));fi
done
done
echo ${b[*]} | tr ' ' '12' > dist_${name}.dat
unset a b

#######################################

Advertisements

2 thoughts on “Calculate mean residence time of water in MD simulation with AMBERTOOLS. Part2

  1. I chose a 1 ns trajectory in which at every 1ps snapshots were saved. i ran first:

    ##################################################
    parm ../DNA_Water.prmtop
    trajin ../prod_5-6ns.nc 1 100000 100
    autoimage
    mask ((:1-46&!@H=)<:4.0&:WAT&!@H=) maskout water.dat
    ##################################################

    after that I ran ./count.sh water.dat
    and got dist_water.dat file.

    the values i found in this file are given as:

    ####################################################################################
    28611112017971670158414491405137113161305125012361204118911641158110911251117111311091931781671571621501581361371351441401221341241271141151251181151101151161619171718191714151314121211151211121211131112111212111111
    ####################################################################################

    please help me interpreting these values.

    thank you

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s