Re: [AMBER] Lazy Question: File conversion NCRST to RST

From: Gustaf Olsson <gustaf.olsson.lnu.se>
Date: Wed, 14 Aug 2019 12:28:44 +0000

Well, I missed it completely. I was so hung upon the “mask” part that I did not carefully read the “important” section regarding distance based masks.

It should now churn along using some loops:

x=1
while [ $x -le 100 ]
        do
        y=10
                while [ $y -le 100 ]
                        do
                        cpptraj << EOF
                        parm *.prmtop
                        trajin nvt'$y'ns.rst
                        reference nvt'$y'ns.rst
                        strip "!((:'$x' <: 8) & ! :'$x')"
                        outtraj host_brt_'$x'_'$y'ns.pdb
                        unstrip
                        strip "!(:'$x')"
                        outtraj guest_brt_'$x'_'$y'ns.pdb
                        run
                        EOF
                        y=$(( y + 10 ))
                done
        x=$(( x + 1 ))
done

Sadly I am not enough of a programer to get the EOF part to work inside a bash script (unexpected EOF) and I have not figured out how to “pipe” commands into cpptraj so there is some copy/paste manoeuvring going on. Still, it beats making 1000 files myself :-)

All the best and thank you again Dan!
// Gustaf

> On 14 Aug 2019, at 13:30, Daniel Roe <daniel.r.roe.gmail.com> wrote:
>
> Sorry - I had forgotten that selection by distance requires a reference
> structure (for further details see the reference manual). Just add a
> ‘reference nvt10.ns.rst7’ after the ‘parm’.
>
> Hope that helps,
>
> -Dan
>
> On Wed, Aug 14, 2019 at 5:32 AM Gustaf Olsson <gustaf.olsson.lnu.se> wrote:
>
>> Well, it seemed fully logical and this is likely shell related. Sadly, I
>> seem unable to figure out how to get the suggested command sequence to
>> execute correctly
>>
>> The
>>
>> strip "!((:1 <: 5) & ! :1)"
>>
>> command produces an error:
>>
>> No reference set, cannot select by distance
>>
>> Meaning that I get the "guest" file correctly and I do get the “host”
>> file, however the only thing striped is :1 and every other molecule is
>> there. I have tried varying or skipping “ and ‘ though this produces other
>> errors where all of the mask is not read or I have “unmatched” parenthesise
>> though I cannot see this in the commands.
>>
>> I have pretty much tried every combination of apostrophes and escape
>> characters I can remember without any luck so once again I am looking for
>> some input from people smarter then me.
>>
>> Best regards
>> // Gustaf
>>
>>
>>
>>> On 12 Aug 2019, at 20:05, Daniel Roe <daniel.r.roe.gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> You could use the 'mask' command or you could use a combination of
>>> 'strip'/'unstrip' and 'outtraj' (which is what I usually do). E.g.
>>>
>>> cpptraj <<EOF
>>> parm *.prmtop
>>> trajin nvt10.ns.rst7
>>> strip "!((:1 <: 5) & ! :1)"
>>> outtraj host.pdb
>>> unstrip
>>> strip "!(:1)"
>>> outtraj guest.pdb
>>> run
>>> EOF
>>>
>>> Note that I'm negating your original masks, which effectively turns
>>> 'strip' into "keep".
>>>
>>> Hope this helps,
>>>
>>> -Dan
>>>
>>> On Wed, Aug 7, 2019 at 9:43 AM Gustaf Olsson <gustaf.olsson.lnu.se>
>> wrote:
>>>>
>>>> Hang on one second
>>>>
>>>> Since there was a flag allowing reading the .nrst file, maybe I don’t
>> need to convert and pass to ambmask for my purpose as the “mask” available
>> in cpptraj should work just fine.
>>>>
>>>> What I am doing right now is the following:
>>>>
>>>> $ ambmask -p *.prmtop -c nvt10ns.rst7 -prnlev 0 -out pdb -find
>> '(:1 <: 5) & ! :1' > host.pdb
>>>> $ ambmask -p *.prmtop -c nvt10ns.rst7 -prnlev 0 -out pdb -find
>> ':1' > guest.pdb
>>>>
>>>> This works fine, printing every residue within 5 angstroms from 1
>> excluding 1 itself to one “host” file and just residue 1 to another “guest”
>> file which can then be used to set up docking runs.
>>>>
>>>> Can I not just use the mask function in cpptraj (which seems identical)
>> to accomplish the same thing? Reading in the .nrst files as described and
>> then creating the same output and then skipping the in-between step of file
>> conversion?
>>>>
>>>> Best regards
>>>> // Gustaf
>>>>
>>>>
>>>>> On 7 Aug 2019, at 14:06, Daniel Roe <daniel.r.roe.gmail.com> wrote:
>>>>>
>>>>> cpptraj -p topology.parm7 -y restart.nrst -x restart.rst7
>>>>>
>>>>> -Dan
>>>>>
>>>>> On Wed, Aug 7, 2019 at 7:41 AM Gustaf Olsson <gustaf.olsson.lnu.se>
>> wrote:
>>>>>>
>>>>>> As the title states, a lazy search for a shortcut so as not having to
>> figure it out by myself.
>>>>>>
>>>>>> What would be the "most scriptable”, non-GUI and fast way to convert
>> from NCRST to old RST(7) format using anything available in the
>> amber/ambertools package?
>>>>>>
>>>>>> I need to convert a number of new binary format to the old ASCII
>> format to process with another program.
>>>>>>
>>>>>> Best regards
>>>>>> // Gustaf
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>
>>> _______________________________________________
>>> 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

_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Wed Aug 14 2019 - 05:30:02 PDT
Custom Search