GSD log values ignored if name contains a "/"

When loading GSD files that contain data in the frame/log block, OVITO ignores chunks whose names contain "/" characters.

HOOMD-blue writes log values using slashes in the namespace, so the current behavior means you cannot access (without a Python modifier) the frame's log in a GSD file written by HOOMD-blue. Since the slashes in the frame's log keys are meant to represent a namespace, I suggest replacing "/" with "." when reading the log chunks in the GSD reader.

The following python script creates a minimal example: it writes 2 GSD files, one where the frame log key contains "/" and the other with "."s instead of "/"s. After loading each file into OVITO, the Global Attributes only contain the frame log data when the key contains dots and not slashes.

import gsd.hoomd


with gsd.hoomd.open('with-slashes.gsd', 'w') as gsdf_slash:
    with gsd.hoomd.open('without-slashes.gsd', 'w') as gsdf_noslash:
        for step in range(2):
            frame = gsd.hoomd.Frame()
            frame.particles.N = 1 
            frame.particles.position = [[0, 0, 0]] 
            key = 'name/space/poperty/value'
            frame.configuration.step = step
            frame.configuration.box = [1, 1, 1, 0, 0, 0]
            frame.log[key] = [0] 
            gsdf_slash.append(frame)
            del frame.log[key]
            frame.log[key.replace('/', '.')] = [0] 
            gsdf_noslash.append(frame)

for _filename in ['with-slashes.gsd', 'without-slashes.gsd']:
    with gsd.hoomd.open(_filename, 'r') as gsdf:
        for frame in gsdf:
            print(frame.log)
Edited Jul 12, 2023 by Tim Moore
Assignee Loading
Time tracking Loading