Re: [AMBER] Cpptraj for loops and dataset operations

From: James Kress via AMBER <amber.ambermd.org>
Date: Wed, 30 Nov 2022 17:25:04 -0500

Do we get the updated Cpptraj when we run amber_update?

Jim

-----Original Message-----
From: Daniel Roe via AMBER <amber.ambermd.org>
Sent: Wednesday, November 30, 2022 12:31 PM
To: Pietro ARONICA <pietroa.bii.a-star.edu.sg>; AMBER Mailing List
<amber.ambermd.org>
Subject: Re: [AMBER] Cpptraj for loops and dataset operations

Hi,

I've implemented this in the GitHub version of cpptraj
(https://github.com/Amber-MD/cpptraj) as of version 6.16.1. There is a new
for loop keyword called 'indata' which will allow you to loop over elements
of a data set. For your example you would use something like:

readdata res.dat name resi intcols 1
for i indata resi:1
  h = $i - 1
  dihedral :$h.C :$i.N :$i.CA :$i.C out dihe_$i.dat done

If you don't want to have to define the dihedrals explicitly you could use
multidihedral, e.g.

readdata res.dat name resi intcols 1
for i indata resi:1
  multidihedral phi resrange $i out dihe_$i.dat done

Hope this helps. Let me know how it works for you! Thanks again for the
suggestion.

-Dan

On Wed, Nov 30, 2022 at 8:07 AM Daniel Roe <daniel.r.roe.gmail.com> wrote:
>
> Hi,
>
> Sorry for the delay in replying. I kept trying to figure out if there
> is a way to do what you want, but I don't think there is yet! You can
> loop over atoms/residues/molecules, files, lists, etc. but not
> elements of a dataset (which is an oversight on my part!). It's a
> great idea and I'll work on getting it implemented ASAP. I've created
> an issue on GitHub to track it here:
> https://github.com/Amber-MD/cpptraj/issues/1003
>
> Thanks for the suggestion!
>
> -Dan
>
> On Fri, Nov 25, 2022 at 1:13 AM Pietro ARONICA via AMBER
> <amber.ambermd.org> wrote:
> >
> > Dear all,
> > I am having a hard time understanding how to use datasets and for loops
work in cpptraj.
> > I have a pdb named file.pdb. I can calculate using the nativecontacts
command all residues in mask1 that are within 6 A of mask2 with a command
like this:
> >
> > nativecontacts :mask1 :mask2 distance 6 resout res.dat
> >
> > The first column of res.dat contains the residue numbers I am
> > interested in. I have read in this file with
> >
> > readdata res.dat name resi
> >
> > What I would like to do at this point is calculate dihedrals of residues
that are match the distance criteria I set before, ie those in the first
column of res.dat. It is my understanding that resi:1 contains these data
points but I do not understand how to extract them or use them.
> > In my mind, the for loop would look a little bit like this:
> >
> > for i in resi:1
> > dihedral :($i-1).C :$i.N :$i.CA :$i.C out dihe_$i.dat done
> >
> > It would loop over the elements of the data set, using that number for
the mask of the dihedral I want to calculate. I would also want to do some
operations on the values.
> > However, I am unable to use the dataset in any way like that. If I just
use the data set on the command line, it gives this:
> >
> > > resi:1
> > [resi:1]
> > Result: 0.000000
> >
> > which I am unsure how to interpret. I know the data is somewhere within
that dataset because if I use writedata it will produce a text file with all
the data points as I expect them.
> > Can anyone explain to me how data sets are used and accessed and
possibly used in for loops?
> > Kind regards
> > Pietro Aronica
> > This e-mail and any attachments are only for the use of the intended
recipient and may contain material that is confidential, privileged and/or
protected by the Official Secrets Act. If you are not the intended
recipient, please delete it or notify the sender immediately. Please do not
copy or use it for any purpose or disclose the contents to any other person.
> > _______________________________________________
> > 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


_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Wed Nov 30 2022 - 14:30:03 PST
Custom Search