# Re: [AMBER] MASK with distance in AMBER.

From: Daniel Roe <daniel.r.roe.gmail.com>
Date: Wed, 17 Aug 2016 10:38:20 -0600

Hi,

What you want to calculate is not straightforward (or easy) to do, but
I believe it is possible. Essentially you want to calculate the
auto-correlation function for water dipole vectors *only* when they
are within a certain distance from solute, correct? In order to do
this you will need to filter out waters when they are outside a
certain distance. Also, the trajectories should be continuous, so you
can't actually use closest (since the ordering of the waters changes
based on the distance to solute) and you may have to calculate
multiple auto-correlation functions for the same water (and probably
exclude those whose residence time is "short"). The way I would
approach it is this. In my example residues 1 to 4 is solute, residue
8 will be the solvent molecule.

For each water (in this case residue 8):
1) Calculate the minimum distance between the water and solute atoms
using the 'nativecontacts' command and 'mindist' keyword:
nativecontacts :1-4 :8.O name distD8 includesolvent mindist

This will generate a data set named distD8[mindist].

2) You can then use this data set to filter out frames that are
outside a given cutoff with 'filter':
filter distD8[mindist] min 0.0 max 6.0 out filter.dat name filterD8

The next step is the tricky part. You'll need to create a script to
give you the range of frames where the distance criterion is met. I'll
give a example using awk:
awk 'BEGIN{ alive = 0; }
{
frame = \$1;
if ( alive == 0 ) {
if (\$2 == 1)
alive = \$1;
} else {
if (\$2 == 0) {
printf("Range: %i to %i is %i frames\n", alive, \$1 - 1, \$1 - alive);
alive = 0;
}
}
}END{
if (alive != 0)
printf("Range: %i to %i is %i frames\n", alive, frame, frame - alive + 1);
}' filter.dat

You can decide how many frames is long enough and then choose those
frame ranges to read into cpptraj and calculate the dipole with
'vector dipole', then calculate the autocorrelation with 'timecorr'.
This would be done for each water. Then you'll average all the
different time correlation functions. I *think* this will work but
again I'm not certain and haven't really tested it out.

Hope this helps,

-Dan

On Tue, Aug 16, 2016 at 12:23 PM, Parviz Seifpanahi Shabane
<sparviz.vt.edu> wrote:
> Dear Dr.Roe
> Thank you for your help.my final goal is calculating the auto-correlation
> function for dipole moment of water molecules in the different distance. I
> did what you said ( using the water shell for finding the number of water
> molecules and then use that number in closest command). My problem now is,
> how to use the output of "closest" command as input for "vector" command
> for calculating the dipole moment of water molecules and then calculating
> the auto-correlation function with using the "timecorr" command.
> Best Regards
> Parviz
>
> On Fri, Aug 12, 2016 at 1:54 PM, Daniel Roe <daniel.r.roe.gmail.com> wrote:
>
>> Hi,
>>
>> Most of this information is in the Amber 16 manual, in 29.2.2 "Atom
>>
>> "Distance-based masks that update each frame are currently only
>> supported by the mask action."
>>
>> Also, the 'mask' command doesn't affect subsequent commands. The
>> reason for this is that it is likely with distance based masks that
>> you will be selecting different numbers of molecules for each frame,
>> which would require that actions essentially be re-setup for a new
>> topology each frame, which is both expensive and impractical.
>>
>> In your case you probably want to estimate the average number of
>> molecules within 6.0 Angstroms of residues 1-1158 (using e.g.
>> 'watershell' with an increased second (upper) shell distance cutoff),
>> then use the 'closest' command to retain exactly that number of water
>> molecules.
>>
>> Hope this helps,
>>
>> -Dan
>>
>> On Fri, Aug 12, 2016 at 9:48 AM, Parviz Seifpanahi Shabane
>> <sparviz.vt.edu> wrote:
>> > Hi All,
>> > I need to use the mask command with distance for my job (below). as you
>> > know for using the mask with the distance we need to give the reference
>> to
>> > Cpptraj. I need to know, how to Cpptraj work on this situation?
>> > My impression is that Cpptraj uses the reference for finding the
>> molecules
>> > (in my case water) in the special distance which was defined by the mask
>> > from the reference file and then track those molecules down during the
>> > simulation, is that correct?(number of molecules did not change for my
>> > case)
>> > does the Cpptraj update the molecules for each frame?
>> > it could be the bug for Cpptraj because molecules will move during the
>> > simulation and too many of properties (in my case auto-correlation
>> function
>> > of the dipole of water molecules near the protein) depend on the position
>> > of molecules.
>> >
>> >
>> > parm 3v03-H++-2braanch.top
>> > reference 3v03-H++-2braanch.prod1.restrt
>> > trajin 3v03-H++-2braanch.prod2.traj
>> >
>> > vector v0 dipole out dipole-G6A.dat (:1-1158<:6.0)&:WAT
>> > timecorr vec1 v0 out auto-correlation-function-G6A.dat order 1
>> >
>> > Best Regards
>> > Parviz
>> > _______________________________________________
>> > AMBER mailing list
>> > AMBER.ambermd.org
>> > http://lists.ambermd.org/mailman/listinfo/amber
>>
>>
>>
>> --
>> -------------------------
>> Daniel R. Roe, PhD
>> Department of Medicinal Chemistry
>> University of Utah
>> 30 South 2000 East, Room 307
>> Salt Lake City, UT 84112-5820
>> http://home.chpc.utah.edu/~cheatham/
>> (801) 587-9652
>> (801) 585-6208 (Fax)
>>
>> _______________________________________________
>> 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

```--
-------------------------
Daniel R. Roe, PhD
Department of Medicinal Chemistry
University of Utah
30 South 2000 East, Room 307
Salt Lake City, UT 84112-5820
http://home.chpc.utah.edu/~cheatham/
(801) 587-9652
(801) 585-6208 (Fax)
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
```
Received on Wed Aug 17 2016 - 10:00:02 PDT
Custom Search