OK great. Do bear in mind that float32 would likely not work if g_rms were running in double precision.
Mark On Wed, Mar 5, 2014 at 2:40 PM, João Henriques < joao.henriques.32...@gmail.com> wrote: > Hi Mark, > > Good to know that the binary dump is just plain data. Then I know that the > problem is uniquely due to the *data type*, which is *exactly* what I > couldn't figure out from the source file. Using the wrong data type due to > not knowing the size and byte-order of the items in the file was obviously > yielding faulty array length values, and that's why I started thinking that > the file may have a more complex structure. > > Just now, I tested using "numpy.float32" (which should have been obvious, > were I not a newbie) as the dtype and it finally worked. The min and max > values correspond to the g_rms output and the array length is finally N**2, > with N being the side length of the symmetric rmsd matrix. > > Thank you for your help, > Best regards, > João > > > > > On Wed, Mar 5, 2014 at 1:23 PM, Mark Abraham <mark.j.abra...@gmail.com > >wrote: > > > On Mar 4, 2014 9:19 PM, "João Henriques" <joao.henriques.32...@gmail.com > > > > wrote: > > > > > > Hello everyone, > > > > > > Let me start by saying that I am unsure whether this is a question for > > the > > > gmx-users or gmx-developers mailing list, but here it goes: > > > > > > I have written a Python/NumPy script that parses the rmsd comparison > > matrix > > > dumped by g_rms in the .xpm format. However the "nlevels" are not > > > sufficient to give me the desired detail for posterior calculations. > > > Therefore I have decided to forget the .xpm and focus on the binary > dump > > > produced by g_rms using the flag -bin. My sole purpose is to fetch the > > > binary rmsd data and pass it into an array, so that I can then do some > > > calculations over it. > > > > > > I am a total newbie in binary file parsing, but I know that I can, for > > > example, use something like "numpy.fromfile" for that purpose. The > > problem > > > is that I have absolutely no idea of what is the structure of the > binary > > > rmsd comparison matrix file. I'm pretty sure that besides the actual > > data, > > > there are other stamps and stuff being written to the file, with > > > potentially different formats as well. I tried looking at gmx_rms.c > but I > > > got lost very quickly. > > > > No, g_rms -bin is very plain, see > > > > > http://redmine.gromacs.org/projects/gromacs/repository/revisions/master/entry/src/gromacs/gmxana/gmx_rms.c#L1073 > > > > Do let us know how you go! > > > > Mark > > > > > Is there anyone out there that might be able to help me identify the > > > correct structure OR is there any Python or C++ routine capable of > doing > > > similar things to what I need? I have no urge in "reinventing the > wheel". > > > > > > P.S.: I know that there is the possibility of modifying g_rms itself, > but > > > that is not what I'm looking for. > > > > > > Thank you in advance, > > > Best regards, > > > João Henriques > > > -- > > > 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-requ...@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-requ...@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-requ...@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-requ...@gromacs.org.