Skip to main content

General simulation data file format.

Project description

GSD

The GSD file format is the native file format for HOOMD-blue. GSD files store trajectories of the HOOMD-blue system state in a binary file with efficient random access to frames. GSD allows all particle and topology properties to vary from one frame to the next. Use the GSD Python API to specify the initial condition for a HOOMD-blue simulation or analyze trajectory output with a script. Read a GSD trajectory with a visualization tool to explore the behavior of the simulation.

Resources

HOOMD examples

Create a hoomd gsd file.

>>> s = gsd.hoomd.Snapshot()
>>> s.particles.N = 4
>>> s.particles.types = ['A', 'B']
>>> s.particles.typeid = [0,0,1,1]
>>> s.particles.position = [[0,0,0],[1,1,1], [-1,-1,-1], [1,-1,-1]]
>>> s.configuration.box = [3, 3, 3, 0, 0, 0]
>>> traj = gsd.hoomd.open(name='test.gsd', mode='wb')
>>> traj.append(s)

Append frames to a gsd file:

>>> def create_frame(i):
...     s = gsd.hoomd.Snapshot();
...     s.configuration.step = i;
...     s.particles.N = 4+i;
...     s.particles.position = numpy.random.random(size=(4+i,3))
...     return s;
>>> with gsd.hoomd.open('test.gsd', 'ab') as t:
...     t.extend( (create_frame(i) for i in range(10)) )
...     print(len(t))
11

Randomly index frames:

>>> with gsd.hoomd.open('test.gsd', 'rb') as t:
...     snap = t[5]
...     print(snap.configuration.step)
4
...     print(snap.particles.N)
8
...     print(snap.particles.position)
[[ 0.56993282  0.42243481  0.5502916 ]
 [ 0.36892486  0.38167036  0.27310368]
 [ 0.04739023  0.13603486  0.196539  ]
 [ 0.120232    0.91591144  0.99463677]
 [ 0.79806316  0.16991436  0.15228257]
 [ 0.13724308  0.14253527  0.02505   ]
 [ 0.39287439  0.82519054  0.01613089]
 [ 0.23150323  0.95167434  0.7715748 ]]

Slice frames:

>>> with gsd.hoomd.open('test.gsd', 'rb') as t:
...     for s in t[5:-2]:
...         print(s.configuration.step, end=' ')
4 5 6 7

File layer examples

with gsd.fl.open(name='file.gsd', mode='wb') as f:
    f.write_chunk(name='position', data=numpy.array([[1,2,3],[4,5,6]], dtype=numpy.float32));
    f.write_chunk(name='angle', data=numpy.array([0, 1], dtype=numpy.float32));
    f.write_chunk(name='box', data=numpy.array([10, 10, 10], dtype=numpy.float32));
    f.end_frame()
with gsd.fl.open(name='file.gsd', mode='rb') as f:
    for i in range(1,f.nframes):
        position = f.read_chunk(frame=i, name='position');
        do_something(position);

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gsd-1.10.0.tar.gz (119.6 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

gsd-1.10.0-cp38-cp38-manylinux1_x86_64.whl (298.1 kB view details)

Uploaded CPython 3.8

gsd-1.10.0-cp37-cp37m-manylinux1_x86_64.whl (283.9 kB view details)

Uploaded CPython 3.7m

gsd-1.10.0-cp36-cp36m-manylinux1_x86_64.whl (285.8 kB view details)

Uploaded CPython 3.6m

File details

Details for the file gsd-1.10.0.tar.gz.

File metadata

  • Download URL: gsd-1.10.0.tar.gz
  • Upload date:
  • Size: 119.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.5

File hashes

Hashes for gsd-1.10.0.tar.gz
Algorithm Hash digest
SHA256 31297c99e395dbfdce21a12f92de19ad8a8943a6187bab9906bd60a4855c311c
MD5 12e3923bdde316cf197f3ae52ec470a8
BLAKE2b-256 b755f173e086a6a5c6cbbbea90405dd432812def2031a93bffc791cfc1d4a7d9

See more details on using hashes here.

File details

Details for the file gsd-1.10.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: gsd-1.10.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 298.1 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.8.0

File hashes

Hashes for gsd-1.10.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 844700fadbad199dc7fa4c2bb4aa12296661c8e060f2369da91c552cde08d925
MD5 271acdb2a7fe5b4978f8674688648032
BLAKE2b-256 0f875fc73d6038b9042ff1d542c9860bc8458a78b58052f30debc7efd11e0318

See more details on using hashes here.

File details

Details for the file gsd-1.10.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: gsd-1.10.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 283.9 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.5

File hashes

Hashes for gsd-1.10.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fd54649377229e9904f4bb40c9dee401ff192bdcaf58d73fbb19adef9bd51e57
MD5 bf9acac6ef254154386505e32477ef36
BLAKE2b-256 e24d920adba447a73109a33ed75159bdf3122b206c46d096fe011e16de04bf17

See more details on using hashes here.

File details

Details for the file gsd-1.10.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: gsd-1.10.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 285.8 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.6.9

File hashes

Hashes for gsd-1.10.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0e592ad80618e28aa5784b7248074f4ac6ca8e7f111eb6f22d6f356c57b9a3f9
MD5 baa6dd9b701ecb5ba3dba3e199a8a995
BLAKE2b-256 bed9c928ae719d3a4d99e561a8ea16c6bd2e003c84c18ea6811d130e79114946

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page