[gmx-users] gmx trjconv -center not working?

Justin Lemkul jalemkul at vt.edu
Fri Feb 8 14:30:31 CET 2019



On 2/8/19 8:29 AM, Mala L Radhakrishnan wrote:
> Hi Justin,
>
> Yes, but I don't want anything sticking out of the box.  I need the shape
> of my entire system, when visualized, to be wholly contained within the
> cubic shape -- and centered on the desired group.  That's pretty much all.
>    Does this clarify?  Does this change what you recommend?

Use -pbc atom instead of -pbc mol in my first suggested command.

-Justin

> Mala
>
> On Fri, Feb 8, 2019 at 8:18 AM Justin Lemkul <jalemkul at vt.edu> wrote:
>
>>
>> On 2/8/19 8:15 AM, Mala L Radhakrishnan wrote:
>>> Hi Justin,
>>>
>>> Also -- this is important, I need to maintain the shape of the cubic box,
>>> so I do *not* want to keep molecules at the box edges whole (I know this
>>> sounds weird, but I need it for my applications) -- so should I use -pbc
>>> atom instead of -pbc mol for the first step?
>> The shape of the box will not change with any of the -pbc options, you
>> may just have a few atoms sticking "out" of the actual dimensions
>> depending on PBC treatment. But the *box* never changes unless you
>> re-wrap or manipulate it with -ur (though, as I've said for a cube, you
>> can't really actually change).
>>
>> -Justin
>>
>>> Thanks again so much -- just want to make sure before I start making
>> these
>>> huge files :)
>>>
>>> Mala
>>>
>>> On Fri, Feb 8, 2019 at 8:07 AM Justin Lemkul <jalemkul at vt.edu> wrote:
>>>
>>>> On 2/8/19 8:03 AM, Mala L Radhakrishnan wrote:
>>>>> Hi Justin,
>>>>>
>>>>> Thank you SO much -- I will try this out, but I have a silly question
>>>>> before I do -- is there a way to dump just the desired frame in the
>> first
>>>>> step itself -- or would that screw up the ordering -- since my xtc
>> files
>>>>> are just so huge and I'd rather not create more huge files than
>>>> necessary?
>>>>> If there is no other way, then I will do it, but these are massive
>> files
>>>>> and I'd need to create them for many simulations.
>>>> You can try, but my suggestion is that you have to be careful in making
>>>> leaps from one reference state to a final state. In principle, it should
>>>> work no matter what, but I've noticed that trjconv does sometimes
>>>> require processing of a full trajectory for PBC and fitting purposes. I
>>>> have no explanation as to why, but if you carefully and methodically
>>>> invoke trjconv, there should never be a problem getting it to behave as
>>>> you need it to.
>>>>
>>>> -Justin
>>>>
>>>>> Thanks,
>>>>>
>>>>> M
>>>>>
>>>>> On Fri, Feb 8, 2019 at 6:56 AM Justin Lemkul <jalemkul at vt.edu> wrote:
>>>>>
>>>>>> On 2/8/19 6:52 AM, Mala L Radhakrishnan wrote:
>>>>>>> Hi Paul,
>>>>>>>
>>>>>>> Thanks for this idea --
>>>>>>>
>>>>>>> ...But it returns what I would expect:
>>>>>>>
>>>>>>> Statistics over 1 steps [ 200000.0000 through 200000.0000 ps ], 3
>> data
>>>>>> sets
>>>>>>> All statistics are over 1 points
>>>>>>>
>>>>>>> Energy                      Average   Err.Est.       RMSD  Tot-Drift
>>>>>>>
>> -------------------------------------------------------------------------------
>>>>>>> Box-X                       12.2482         --          0          0
>>>>>> (nm)
>>>>>>> Box-Y                       12.2482         --          0          0
>>>>>> (nm)
>>>>>>> Box-Z                       12.2482         --          0          0
>>>>>> (nm)
>>>>>>> This matches what the pdb extracted file says (i.e. the file which
>> does
>>>>>> not
>>>>>>> have the complex centered at the Box-X/2, Box-Y/x, Box-Z/2)
>>>>>>> So I'm still not sure what's going on -- any other thoughts?
>>>>>>     From your trjconv command, it looks like you are somewhat
>>>> inefficiently
>>>>>> trying to simply output the final frame, is that correct?
>>>>>>
>>>>>> I have found quirky behavior in trjconv when trying to do multiple
>>>>>> actions (you're centering and manipulating PBC at the same time) while
>>>>>> also skipping many frames. Here's what I would suggest:
>>>>>>
>>>>>> gmx trjconv -s md.tpr -f md.xtc -pbc mol -o md_mol.xtc
>>>>>> gmx trjconv -s md.tpr -f md_mol.xtc -center -o md_center.xtc -n
>>>> index.ndx
>>>>>> gmx trjconv -s md.tpr -f md_center.xtc -dump 200000
>>>>>>
>>>>>> Does that improve the situation? If not, please send a minimal test
>> case
>>>>>> to me off-list and I will take a look.
>>>>>>
>>>>>> -Justin
>>>>>>
>>>>>>> Mala
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Feb 8, 2019 at 5:39 AM Peter Kroon <p.c.kroon at rug.nl> wrote:
>>>>>>>
>>>>>>>> What does "gmx energy -b 20000 -e 20000" give as box dimensions?
>>>>>>>>
>>>>>>>>
>>>>>>>> Peter
>>>>>>>>
>>>>>>>> On 07-02-19 22:20, Mala L Radhakrishnan wrote:
>>>>>>>>> Hi Justin,
>>>>>>>>>
>>>>>>>>> Thank you -- the good news is that the center of mass of this group
>>>>>> does
>>>>>>>> in
>>>>>>>>> fact match what I calculate to be the COM with my script.
>>>>>>>>>
>>>>>>>>> BUT, the bad news is that this is not in the center of the box
>> after
>>>> I
>>>>>>>> have
>>>>>>>>> asked for it to be centered (which I presume it should be)::
>>>>>>>>>
>>>>>>>>> COM:
>>>>>>>>> 5.95324    6.00572    5.68943
>>>>>>>>>
>>>>>>>>> The cubic box is 12.249 long (as noted in the CRYST1 field of the
>> pdb
>>>>>>>> file
>>>>>>>>> and its left corner is at the origin (I know this because I have
>>>> atoms
>>>>>>>> that
>>>>>>>>> go all the way to the edges of the box and my minimum x,y, and x
>>>>>>>>> coordinates are basically 0 and my maximum are basically 12.24 in
>> all
>>>>>>>> three
>>>>>>>>> directions, which would make the center of the box:
>>>>>>>>>
>>>>>>>>> 6.1245, 6.1245, 6.1245
>>>>>>>>>
>>>>>>>>> So it's close but a few angstroms off.  Can you please tell me what
>>>>>> might
>>>>>>>>> be going on here?  I am happy to share files with, as I'd be really
>>>>>>>>> grateful for your help.  Again, I've written a scrip to translate
>> and
>>>>>>>>> "wrap" the atoms across the pbc in the worst case scenario, but I
>>>> have
>>>>>> to
>>>>>>>>> imagine gromacs should be able to do this correctly.
>>>>>>>>>
>>>>>>>>> Again - this is the command I used to extract the hopefully
>> centered
>>>>>>>> frame:
>>>>>>>>> gmx trjconv -f md.xtc -o all.pdb -s md.tpr -b 200000 -e 200000 -n
>>>>>>>> INDEX.ndx
>>>>>>>>> -pbc atom -center
>>>>>>>>>
>>>>>>>>> ...and I chose the correct index (and extracted the same atoms just
>>>> in
>>>>>>>> case
>>>>>>>>> to make sure that I knew exactly what atoms it thought it was
>>>>>> centering,
>>>>>>>> in
>>>>>>>>> case something was in fact wrong with the index file)
>>>>>>>>>
>>>>>>>>> Thank you so much,
>>>>>>>>>
>>>>>>>>> Mala
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Thu, Feb 7, 2019 at 1:54 PM Justin Lemkul <jalemkul at vt.edu>
>>>> wrote:
>>>>>>>>>> On 2/7/19 1:52 PM, Mala L Radhakrishnan wrote:
>>>>>>>>>>> Hi Justin,
>>>>>>>>>>>
>>>>>>>>>>> I've verified the I'm entering in the right group and that it's
>>>>>> correct
>>>>>>>>>> in
>>>>>>>>>>> the index file.  Where do I find the output for what it thinks is
>>>> the
>>>>>>>>>>> center of mass before and after?  That would be helpful output,
>>>> but I
>>>>>>>>>>> haven't found such output in standard output or error.
>>>>>>>>>> gmx traj -ox -com
>>>>>>>>>>
>>>>>>>>>> -Justin
>>>>>>>>>>
>>>>>>>>>>> thanks again for instructions on how to get this info..
>>>>>>>>>>> Mala
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Feb 7, 2019 at 1:46 PM Justin Lemkul <jalemkul at vt.edu>
>>>>>> wrote:
>>>>>>>>>>>> On 2/7/19 1:36 PM, Mala L Radhakrishnan wrote:
>>>>>>>>>>>>> Thanks...but these don't really address the issue I have.  I've
>>>>>>>> written
>>>>>>>>>>>> my
>>>>>>>>>>>>> own script now to do re-centering and looping of atoms across
>> the
>>>>>> box
>>>>>>>>>>>> walls
>>>>>>>>>>>>> myself, but I am still really unclear why -center does not in
>>>> fact
>>>>>>>>>> center
>>>>>>>>>>>>> the molecule in the box either at its geometric center OR its
>>>>>> center
>>>>>>>> of
>>>>>>>>>>>>> mass (I have written scripts to test both out and neither
>> match,
>>>>>> and
>>>>>>>>>>>>> visually the molecule is clearly not centered in the box)
>>>>>>>>>>>>>
>>>>>>>>>>>>> To me it definitely seems like something is not right with this
>>>>>>>> utility
>>>>>>>>>>>> or
>>>>>>>>>>>>> something about the options I've used are conflicting in ways I
>>>>>> don't
>>>>>>>>>>>>> understand:
>>>>>>>>>>>>>        -pbc atom -center (a group from index file)
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks again for any other ideas...
>>>>>>>>>>>> I've only been loosely following this thread, but I've never
>> had a
>>>>>>>>>>>> problem where trjconv didn't center as I wanted. Have you
>> verified
>>>>>>>> that
>>>>>>>>>>>> the index group is correct, and you're making the proper
>>>> selection?
>>>>>>>> What
>>>>>>>>>>>> does gmx traj report as the center-of-mass coordinates for those
>>>>>>>> groups
>>>>>>>>>>>> before and after trjconv tries to center them?
>>>>>>>>>>>>
>>>>>>>>>>>> -Justin
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> ==================================================
>>>>>>>>>>>>
>>>>>>>>>>>> Justin A. Lemkul, Ph.D.
>>>>>>>>>>>> Assistant Professor
>>>>>>>>>>>> Office: 301 Fralin Hall
>>>>>>>>>>>> Lab: 303 Engel Hall
>>>>>>>>>>>>
>>>>>>>>>>>> Virginia Tech Department of Biochemistry
>>>>>>>>>>>> 340 West Campus Dr.
>>>>>>>>>>>> Blacksburg, VA 24061
>>>>>>>>>>>>
>>>>>>>>>>>> jalemkul at vt.edu | (540) 231-3129
>>>>>>>>>>>> http://www.thelemkullab.com
>>>>>>>>>>>>
>>>>>>>>>>>> ==================================================
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Gromacs Users mailing list
>>>>>>>>>>>>
>>>>>>>>>>>> * Please search the archive at
>>>>>>>>>>>> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List
>>>> before
>>>>>>>>>>>> posting!
>>>>>>>>>>>>
>>>>>>>>>>>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>>>>>>>>>>>
>>>>>>>>>>>> * For (un)subscribe requests visit
>>>>>>>>>>>>
>>>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users
>>>>>> or
>>>>>>>>>>>> send a mail to gmx-users-request at gromacs.org.
>>>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> ==================================================
>>>>>>>>>>
>>>>>>>>>> Justin A. Lemkul, Ph.D.
>>>>>>>>>> Assistant Professor
>>>>>>>>>> Office: 301 Fralin Hall
>>>>>>>>>> Lab: 303 Engel Hall
>>>>>>>>>>
>>>>>>>>>> Virginia Tech Department of Biochemistry
>>>>>>>>>> 340 West Campus Dr.
>>>>>>>>>> Blacksburg, VA 24061
>>>>>>>>>>
>>>>>>>>>> jalemkul at vt.edu | (540) 231-3129
>>>>>>>>>> http://www.thelemkullab.com
>>>>>>>>>>
>>>>>>>>>> ==================================================
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Gromacs Users mailing list
>>>>>>>>>>
>>>>>>>>>> * Please search the archive at
>>>>>>>>>> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List
>> before
>>>>>>>>>> posting!
>>>>>>>>>>
>>>>>>>>>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>>>>>>>>>
>>>>>>>>>> * For (un)subscribe requests visit
>>>>>>>>>>
>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users
>>>> or
>>>>>>>>>> send a mail to gmx-users-request at gromacs.org.
>>>>>>>>>>
>>>>>>>> --
>>>>>>>> Gromacs Users mailing list
>>>>>>>>
>>>>>>>> * Please search the archive at
>>>>>>>> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
>>>>>>>> posting!
>>>>>>>>
>>>>>>>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>>>>>>>
>>>>>>>> * For (un)subscribe requests visit
>>>>>>>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users
>> or
>>>>>>>> send a mail to gmx-users-request at gromacs.org.
>>>>>>>>
>>>>>> --
>>>>>> ==================================================
>>>>>>
>>>>>> Justin A. Lemkul, Ph.D.
>>>>>> Assistant Professor
>>>>>> Office: 301 Fralin Hall
>>>>>> Lab: 303 Engel Hall
>>>>>>
>>>>>> Virginia Tech Department of Biochemistry
>>>>>> 340 West Campus Dr.
>>>>>> Blacksburg, VA 24061
>>>>>>
>>>>>> jalemkul at vt.edu | (540) 231-3129
>>>>>> http://www.thelemkullab.com
>>>>>>
>>>>>> ==================================================
>>>>>>
>>>>>> --
>>>>>> Gromacs Users mailing list
>>>>>>
>>>>>> * Please search the archive at
>>>>>> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
>>>>>> posting!
>>>>>>
>>>>>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>>>>>
>>>>>> * For (un)subscribe requests visit
>>>>>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
>>>>>> send a mail to gmx-users-request at gromacs.org.
>>>>>>
>>>> --
>>>> ==================================================
>>>>
>>>> Justin A. Lemkul, Ph.D.
>>>> Assistant Professor
>>>> Office: 301 Fralin Hall
>>>> Lab: 303 Engel Hall
>>>>
>>>> Virginia Tech Department of Biochemistry
>>>> 340 West Campus Dr.
>>>> Blacksburg, VA 24061
>>>>
>>>> jalemkul at vt.edu | (540) 231-3129
>>>> http://www.thelemkullab.com
>>>>
>>>> ==================================================
>>>>
>>>> --
>>>> Gromacs Users mailing list
>>>>
>>>> * Please search the archive at
>>>> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
>>>> posting!
>>>>
>>>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>>>
>>>> * For (un)subscribe requests visit
>>>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
>>>> send a mail to gmx-users-request at gromacs.org.
>>>>
>> --
>> ==================================================
>>
>> Justin A. Lemkul, Ph.D.
>> Assistant Professor
>> Office: 301 Fralin Hall
>> Lab: 303 Engel Hall
>>
>> Virginia Tech Department of Biochemistry
>> 340 West Campus Dr.
>> Blacksburg, VA 24061
>>
>> jalemkul at vt.edu | (540) 231-3129
>> http://www.thelemkullab.com
>>
>> ==================================================
>>
>> --
>> Gromacs Users mailing list
>>
>> * Please search the archive at
>> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
>> posting!
>>
>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>
>> * For (un)subscribe requests visit
>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
>> send a mail to gmx-users-request at gromacs.org.
>>
>

-- 
==================================================

Justin A. Lemkul, Ph.D.
Assistant Professor
Office: 301 Fralin Hall
Lab: 303 Engel Hall

Virginia Tech Department of Biochemistry
340 West Campus Dr.
Blacksburg, VA 24061

jalemkul at vt.edu | (540) 231-3129
http://www.thelemkullab.com

==================================================



More information about the gromacs.org_gmx-users mailing list