[gmx-developers] Questions on how to use the gromacs API
teemu.murtola at gmail.com
Tue Aug 26 06:15:38 CEST 2014
On Fri, Aug 22, 2014 at 11:55 PM, Yunlong Liu <yliu120 at jh.edu> wrote:
> Sorry to spam your mailbox but I really like to ask you some questions
> regarding to how to use the API of Gromacs 5.0.
Please keep correspondence like this on the mailing lists; you have a
chance of getting a reply faster, and others will benefit from the
I read the content on the website
> But the example and the instructions are too less to make sense for me. So
> for example, I would like to know if I have a trr trajectory file, how I
> can read out the position information of a certain selection, e.g., "resid
> 940 to 950" to an array.
> Can you please give me an example of the code?
What exactly have you read, and what things would you like to have
clarified? Have you compiled the template analysis program and studied how
it works (e.g., based on the documentation)? That should provide a simple
enough starting point for experimenting. The documentation cannot possibly
cover examples of all imaginable uses.
As Roland already pointed out on the mailing list, your question is
somewhat too specific: if you start from the analysis program template, you
will automatically get support for multiple trajectory formats and allow
the user of the tool to provide the selection on the command line or
interactively. To access the position information for a selection, you use
the Selection and SelectionPosition classes. Both are used in the template
program to show how to access the objects, and you can look up the full
list of members (e.g., for accessing the coordinates) in the documentation.
You can also take a look at the existing tools in
src/gromacs/trajectoryanalysis/modules/. For example distance.cpp contains
a relatively simple tool that accesses coordinates directly.
> And further, where do you present the standard of those selection parse,
> like resid or residue, which one is the correct format?
Some basics of the selections are explained in the manual, and it
references 'gmx help selections' (which you can type on the command line)
for details on the syntax. You can also access the same help by typing
'help' in the interactive selection prompt (that you get by, e.g., running
the template analysis program or 'gmx select' with some input files).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the gromacs.org_gmx-developers