• ## Outreach

From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Fri Feb 10 2017 - 16:36:10 CST

Hi John,

We agree that x is the fastest varying, its just that usually this
arrangement is known as column-major/fortran ordering rather than
row-major/C ordering as far as python is concerned, and that's why numpy
needs to be told about it. :)

-Josh

On 02/10/2017 03:06 PM, John Stone wrote:
> Josh,
> VMD does not store volumetric data in a Fortran ordering. Most likely
> there is a bug in your python interface there... The volumetric data
> is stored in C-like 0-index order, with x varying fastest, then y, then z.
> It's not clear to me how you would have gotten Python to think that the
> above structure is a Fortran order unless you have inverted the index ordering
> in some way also.
>
> Cheers,
> john
>
>
> On Fri, Feb 10, 2017 at 09:52:31PM +0000, Vermaas, Joshua wrote:
>> Hi Karl,
>>
>> Here is the python code that I use to interpret the volumetric data itself:
>>
>> data, shape, origin, delta = molecule.get_volumetric(molid, volid)
>> data = np.array(data) #By default the first output is a tuple. This turns it into a 1-D array that numpy likes
>> shape = np.array(shape) #Ditto here
>> data = data.reshape(shape, order='F') #We actually want this to be 3-D. :) Importantly, because of how the data is stored internally by VMD, numpy needs to be told this is in fortran ('F') order, otherwise your data won't make any sense. Why a program written in C (VMD) stores its data in fortran order is beyond me, but this seems to actually be pretty common in VMD internal datastructures.
>> delta = np.array(delta).reshape(3,3) #This is basically how long each axis is. If you want the stepsize per axis, divide delta by shape-1
>>
>> Then with some annoying index math, it should be possible to figure out what the distance is for any point in space.
>>
>> -Josh
>>
>> On 02/10/2017 02:36 PM, Karl Decker wrote:
>> Hello all. My colleagues and I are up against a problem: what is the structure of the data created by the distance map function of VolMap? We have a method for extracting VolMap distance map data, without writing to disk, using the python object mol_get_volumetric. We can then use the data in a plugin of our own devising. However, we don't know how the data is arranged when it is created by VolMap. We are trying to avoid writing the data to disk because it is very slow compared to the timescale of the other aspects of the plugin.
>>
>> Could the author of VolMap provide some insight into the data structure VolMap uses when creating a distance map?
>>
>> Thanks,
>> Karl
>>