# =?x-gbk?Q?=BB=D8=B8=B4=A3=BA_=5Bgmx-users=5D_How_to_?= =?x-gbk?Q?save_the_coordinates_of_all_atoms_in_the_2D-ar?= =?x-gbk?Q?rays_using_xdrfile=3F?=

Mark Abraham Mark.Abraham at anu.edu.au
Tue Nov 30 02:08:15 CET 2010

```On 30/11/2010 11:10 AM, Ó¢ÐÛ²»ÔÙ¼ÅÄ¯ wrote:
> Dear Mark,
> Thank you for your reply. It seems reasonable to deal with a frame at
> one time. But in my code, the coordinates in two different frames are
> frequently required to compare to each other. Other part of this code
> is like g_msd which calculates the mean-squared displacements for the
> atoms satisfied with the conditions. So, first of all, I had better
> save the coordinates in the 2D-arrays using xdrfile. I do not find
> such a tool in gmx that can realize it. Is there any other algorithms
> to do so more effectively? Please provide more detail about it.

position[frame][atom][axisdirection] i.e. of rvec**. You'll also likely
get better cache performance than if you separate the x, y and z
coordinates, which you're likely to want to use together.

If you're doing an all-against-all analysis, you can structure that as
two loops over frames such that you only need two frames in memory at
any time. Likewise if you can determine the pairs of frames that need to
be analysed, and put them in a sorted list.

Mark

> Yours sincerely,
> Chaofu Wu, Dr.
> ------------------ Ô­Ê¼ÓÊ¼þ ------------------
> *·¢¼þÈË:* "Mark Abraham"<Mark.Abraham at anu.edu.au>;
> *·¢ËÍÊ±¼ä:* 2010Äê11ÔÂ29ÈÕ(ÐÇÆÚÒ») ÍíÉÏ7:38
> *ÊÕ¼þÈË:* "Discussion list for GROMACS users"<gmx-users at gromacs.org>;
> *Ö÷Ìâ:* Re: [gmx-users] How to save the coordinates of all atoms inthe
> 2D-arrays using xdrfile?
> On 28/11/2010 12:12 AM, Ó¢ÐÛ²»ÔÙ¼ÅÄ¯ wrote:
> > Dear gmxers,
> > I am trying to perform an analysis on the trjectory file using xdrfile
> > library. First of all, I want to save the coordinates of all atoms in
> > three 2D-arrays, i.e. xx[step-1][natom-1], yy[step-1][natom-1],
> > zz[step-1][natom-1]. How to do so? Could you give me some hints,
> > please? If you had happened to do so, could you kindly send the code
> > to me? Thanks a lot.
> > Yours sincerely,
> > Chaofu Wu, Dr.
>
> You probably don't want to do that, because it doesn't scale to large
> numbers of trajectory frames - you will run out of memory eventually. If
> at all possible you should structure your algorithm to deal with one
> frame at a time. There are already GROMACS functions that make that
> easy. Pick a GROMACS trajectory analysis tool that sounds fairly simple
> and vaguely similar to what you want to do, and look at how its code
> works.
>
> Mark
> --
> gmx-users mailing list gmx-users at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-users
> Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/Search before posting!
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-users-request at gromacs.org.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-users/attachments/20101130/914454e3/attachment.html>
```