[gmx-users] .dat file from gmx densmap doestnottmatchtprescribedtsize

Michele Pellegrino micpel at kth.se
Thu Jan 23 14:09:25 CET 2020


You are welcome, Christian.
I see that you reported my initial message in the issue: I have to say the initial mismatch I reported was due to the script I was using for reading the file, and not to the file format itself, while the actual value for the mismatch is reported in the answer to David van der Spoel.

Thanks.

Cheers,
Michele

________________________________________
From: gromacs.org_gmx-users-bounces at maillist.sys.kth.se <gromacs.org_gmx-users-bounces at maillist.sys.kth.se> on behalf of Christian Blau <blau at kth.se>
Sent: 23 January 2020 13:30
To: gromacs.org_gmx-users at maillist.sys.kth.se
Subject: Re: [gmx-users] .dat file from gmx densmap doestnottmatchtprescribedtsize

Hi Michele,


Thanks for the input and suggestion!


I created a redmine issue using your observations that you can follow at
https://redmine.gromacs.org/issues/3353


Best,

Christian

On 2020-01-23 11:03, Michele Pellegrino wrote:
> Ok, I believe I have found the nature of this 'quirk' looking at the source code (as Berk suggested me to do).
> I was assuming a format, but GROMACS is producing another: the .dat file in the output contains the values PLUS the coordinates for each bin, that is the first row and the first colum are not denisty values, but coordinates; hence the output matrix is indeed (n1+1)x(n2+1), the actual values being in grid[1:n1-1,1:n2-1] (0-start index convention).
> So apparently is not a bug in the code, but just a misunderstanding of me as user; I double checked the documentation (both for 2019.04 and for the new 2020 release) and I did not find any reference to the format of the output file: could it be a good idea to incude some indication in that regard?
>
> Cheers,
> Michele
>
> * there is a typo in the original message (2:n2-2 instead of 1:n2-1)
> ________________________________________
> From: gromacs.org_gmx-users-bounces at maillist.sys.kth.se <gromacs.org_gmx-users-bounces at maillist.sys.kth.se> on behalf of Michele Pellegrino <micpel at kth.se>
> Sent: 22 January 2020 22:58
> To: gmx-users at gromacs.org
> Subject: Re: [gmx-users] .dat file from gmx densmap doestnottmatchtprescribedtsize
>
> I tried just now: it did not work: 1728 values expected, 1645 values in the .dat file.
> I managed to make it work by defining the number of values in each direction as (in Python):
> Nx = np.sqrt(Nda*Lx/Lz)
> Nz = Nx*Lz/Lx
> Nx = int( np.round(Nx) )
> Nz = int( np.round(Nz) )
> being Nda the number of values in the .dat file and Lx (resp. Lz) the lenght of the simulation box in the x (z) direction (np stands for numpy).
> However, I believe this manipulation should not be necessary.
>
> Cheers,
> Michele
> ________________________________________
> From: gromacs.org_gmx-users-bounces at maillist.sys.kth.se <gromacs.org_gmx-users-bounces at maillist.sys.kth.se> on behalf of David van der Spoel <spoel at xray.bmc.uu.se>
> Sent: 22 January 2020 22:07
> To: gmx-users at gromacs.org
> Subject: Re: [gmx-users] .dat file from gmx densmap doestnottmatchtprescribedtsize
>
> Den 2020-01-22 kl. 18:44, skrev Michele Pellegrino:
>> Ok, thank you.
>> I am counting the elements assuming they are in an array organized in a row major fashion.
> have you tried supplying -n1 47 -n2 35 to be able to check manually?
>
> (by the way a resolution of 0.1 Angstrom is unlikely to give you a
> smooth surface)
>> Scarica Outlook per Android<https://aka.ms/ghei36>
>> ________________________________
>> From: gromacs.org_gmx-users-bounces at maillist.sys.kth.se <gromacs.org_gmx-users-bounces at maillist.sys.kth.se> on behalf of Berk Hess <gmx3 at hotmail.com>
>> Sent: Wednesday, January 22, 2020 6:34:47 PM
>> To: gmx-users at gromacs.org <gmx-users at gromacs.org>
>> Subject: Re: [gmx-users] .dat file from gmx densmap does not match prescribed size
>>
>> A grid element
>>
>> I looked at the code and it directly uses n1 and n2 you provide. So I thought that it might be that the code reading the file has a limit on the number of characters on a line.
>>
>> /Berk
>>
>> ________________________________
>> From: gromacs.org_gmx-users-bounces at maillist.sys.kth.se <gromacs.org_gmx-users-bounces at maillist.sys.kth.se> on behalf of Michele Pellegrino <micpel at kth.se>
>> Sent: Wednesday, January 22, 2020 5:07 PM
>> To: gmx-users at gromacs.org <gmx-users at gromacs.org>
>> Subject: Re: [gmx-users] .dat file from gmx densmap does not match prescribed size
>>
>>
>> What do you mean by 'element'?
>>
>> Anyway, part of the issue was in how I was reading the file; with a little modification of the script I reduced the mismatch, but it still persists.
>> Could it be because GROMACS forces a grid with same meshwith in x and (in my case) z direction, so that the used should impose either -n1 OR -n2 (but not both)? Or maybe the issue is just in the format of the .dat output file?
>>
>> By the way, the simulation box is 47.72970  x 5.51140 x 35.37240 nanometers (if that may help understanding the issue).
>>
>> Thanks,
>> Michele
>>
>> ________________________________________
>> From: gromacs.org_gmx-users-bounces at maillist.sys.kth.se <gromacs.org_gmx-users-bounces at maillist.sys.kth.se> on behalf of Berk Hess <gmx3 at hotmail.com>
>> Sent: 22 January 2020 16:49
>> To: gmx-users at gromacs.org
>> Subject: Re: [gmx-users] .dat file from gmx densmap does not match      prescribed      size
>>
>> How are you counting the elements? Lines with 3531 elements are very long, so they can easily exceed some limit.
>>
>> /Berk
>>
>> ________________________________
>> From: gromacs.org_gmx-users-bounces at maillist.sys.kth.se <gromacs.org_gmx-users-bounces at maillist.sys.kth.se> on behalf of Michele Pellegrino <micpel at kth.se>
>> Sent: Tuesday, January 21, 2020 5:16 PM
>> To: gromacs.org_gmx-users at maillist.sys.kth.se <gromacs.org_gmx-users at maillist.sys.kth.se>
>> Subject: [gmx-users] .dat file from gmx densmap does not match prescribed size
>>
>> Hello,
>>
>>
>> I am struggling a little bit with gmx densmap. I am trying to obtain a matrix with density values from the .dat file generated by the program; however the number of data in the output file does not match what I am expecting.
>>
>> I tried to prescribe both the number of bins in each direction (-n1 and -n2 options) and the grid size (-bin option), not at the same, of course:
>>
>>
>> gmx densmap -f traj.trr -s system.tpr -od densmap.dat -b 800.0 -e 1200.0 -aver y -n1 4772 -n2 3531
>>
>>
>> OR (equivalently):
>>
>>
>> gmx densmap -f traj.trr -s system.tpr -od densmap.dat -b 800.0 -e 1200.0 -aver y -bin 0.01
>>
>>
>> In both cases I get a dimension mismatch (I expect 16849932 values but I get 4359553).
>>
>> I am using GROMACS 2019.4?.
>>
>>
>> What am I doing wrong?
>>
>>
>> Thanks for your help.
>>
>>
>> Cheers,
>>
>> Michele
>> --
>> 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.
>> --
>> 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.
>>
>
> --
> David van der Spoel, Ph.D., Professor of Biology
> Head of Department, Cell & Molecular Biology, Uppsala University.
> Box 596, SE-75124 Uppsala, Sweden. Phone: +46184714205.
> http://www.icm.uu.se
> --
> 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.
--
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.


More information about the gromacs.org_gmx-users mailing list