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.Frame()
>>> 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='w')
>>> traj.append(s)

Append frames to a gsd file:

>>> def create_frame(i):
...     s = gsd.hoomd.Frame();
...     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', 'a') 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', 'r') as t:
...     frame = t[5]
...     print(frame.configuration.step)
4
...     print(frame.particles.N)
8
...     print(frame.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', 'r') 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='w') 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='r') 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-4.2.0.tar.gz (193.3 kB view details)

Uploaded Source

Built Distributions

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

gsd-4.2.0-cp311-abi3-win_amd64.whl (256.7 kB view details)

Uploaded CPython 3.11+Windows x86-64

gsd-4.2.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (619.1 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

gsd-4.2.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (606.3 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

gsd-4.2.0-cp311-abi3-macosx_11_0_arm64.whl (264.6 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

gsd-4.2.0-cp311-abi3-macosx_10_9_x86_64.whl (262.7 kB view details)

Uploaded CPython 3.11+macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: gsd-4.2.0.tar.gz
  • Upload date:
  • Size: 193.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gsd-4.2.0.tar.gz
Algorithm Hash digest
SHA256 eb197abd735e98817bcdc1ee34e4968231d572da48c097b3ccf316be828cf86a
MD5 10e0410175b525bfca8c7aa2651ccbe9
BLAKE2b-256 15fb9d4d99d7a456f830660112b9c369fb4281793f8284f99ca9b2bfabcd4ed5

See more details on using hashes here.

File details

Details for the file gsd-4.2.0-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: gsd-4.2.0-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 256.7 kB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gsd-4.2.0-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 3ebb1b58cb2bd2f9527e4295dc79f3188221ef21242de4e5c042825833f838b2
MD5 6fa278d924747c7a1a1d865821370f11
BLAKE2b-256 63a78d13240a109b9f73d5723565eca024c087d0e7cbad6ac096598acaeb4421

See more details on using hashes here.

File details

Details for the file gsd-4.2.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for gsd-4.2.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7bb37fe16926377e479c1c3a8ff9817d160a085231bf7fc9fb9a9cfee97fdb07
MD5 5160558cb5aa0da9dd23afa9a0e51733
BLAKE2b-256 180713885db43a85efe6ff9e67f54d416efd3cb50de5ee18ab176b288c91e4b8

See more details on using hashes here.

File details

Details for the file gsd-4.2.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for gsd-4.2.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 46a9dfa772131c57d0ee3f390a72b809e29bb91cb569f31883d324ed7343650a
MD5 b3e101b0d877a12d198d39173d90ee1d
BLAKE2b-256 218a8dc6019a8cb5513c22d07d99669a1e77f76369d82144d3f37f5e1125ac19

See more details on using hashes here.

File details

Details for the file gsd-4.2.0-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: gsd-4.2.0-cp311-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 264.6 kB
  • Tags: CPython 3.11+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gsd-4.2.0-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 86044ad658665486abc50a0b60322e9d502f1e15c438c40977d8afccb0117934
MD5 2c938554db6485305f8d38131c3e0454
BLAKE2b-256 20b20808049f31b207ea4909c4ecfabca809e1f8f030933c5397905c86dd08e7

See more details on using hashes here.

File details

Details for the file gsd-4.2.0-cp311-abi3-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: gsd-4.2.0-cp311-abi3-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 262.7 kB
  • Tags: CPython 3.11+, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gsd-4.2.0-cp311-abi3-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f97d41eb780c1635180c6df934977280252307fa1ecfc84c4d73d87e27cfb56b
MD5 c7440856291375ca4d8cafcb09a37b84
BLAKE2b-256 c8a0a55e9b178d65eb00eac02bf94612f89f9d859f683d68f4a80b64a8267d9c

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