General simulation data file format.
Project description
GSD
GSD (General Simulation Data) is a file format specification and a library to read and write it. The package also contains a python module that reads and writes hoomd schema gsd files with an easy to use syntax.
See the full GSD documentation at readthedocs.io.
Overview
GSD files:
- Efficiently store many frames of data from simulation runs.
- High performance file read and write.
- Support arbitrary chunks of data in each frame (position, orientation, type, etc...).
- Append frames to an existing file with a monotonically increasing frame number.
- Resilient to job kills.
- Variable number of named chunks in each frame.
- Variable size of chunks in each frame.
- Each chunk identifies data type.
- Common use cases: NxM arrays in double, float, int, char types.
- Generic use case: binary blob of N bytes.
- Easy to integrate into other tools with python, or a C API (< 1k lines).
- Fast random access to frames.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gsd-1.6.2.tar.gz.
File metadata
- Download URL: gsd-1.6.2.tar.gz
- Upload date:
- Size: 198.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58a6669f2375936810d74c3ee7e62c5616acf9e15aa32603701e55ab6fada5f5
|
|
| MD5 |
823b29d365c887962ca73f221a3a2864
|
|
| BLAKE2b-256 |
1dbd92ee21148fa80a6a7fbd5b5e80f4bc29f9a18d80a83d31563cb8e7c15142
|
File details
Details for the file gsd-1.6.2-cp37-cp37m-manylinux1_x86_64.whl.
File metadata
- Download URL: gsd-1.6.2-cp37-cp37m-manylinux1_x86_64.whl
- Upload date:
- Size: 274.0 kB
- Tags: CPython 3.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d186d76627a601b5aaf45631452f2b2eab4473e2ad2e33b384caf7bd29756866
|
|
| MD5 |
4f6bd8d9ddcf18c31ad36c5aab46268c
|
|
| BLAKE2b-256 |
8671dfa4822c9655236ac1e94f72c5ccaa86a159163c0f39a7e1cf7f278453e2
|
File details
Details for the file gsd-1.6.2-cp36-cp36m-manylinux1_x86_64.whl.
File metadata
- Download URL: gsd-1.6.2-cp36-cp36m-manylinux1_x86_64.whl
- Upload date:
- Size: 274.9 kB
- Tags: CPython 3.6m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9807b92d3f8f03f8bfdb110d0278e19b363d41b99ef6524ed374416269756250
|
|
| MD5 |
d51676e7596af5b6c280d8c1c18750d7
|
|
| BLAKE2b-256 |
9eaec729d6e1510dc85cfef4e090e78d924ad44049ec9e6c9b627abe388b8906
|
File details
Details for the file gsd-1.6.2-cp35-cp35m-manylinux1_x86_64.whl.
File metadata
- Download URL: gsd-1.6.2-cp35-cp35m-manylinux1_x86_64.whl
- Upload date:
- Size: 263.7 kB
- Tags: CPython 3.5m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b217d2556f2ad030e15a587fea92e9312354235a14198970347b8297f0032622
|
|
| MD5 |
5a45811e70cedfe13843329777084555
|
|
| BLAKE2b-256 |
014b74ffc6e3accc6663bfeb23d60bad5ba25b51705b52e83d17c131c7d96470
|
File details
Details for the file gsd-1.6.2-cp27-cp27mu-manylinux1_x86_64.whl.
File metadata
- Download URL: gsd-1.6.2-cp27-cp27mu-manylinux1_x86_64.whl
- Upload date:
- Size: 258.8 kB
- Tags: CPython 2.7mu
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c08e8b8ee16224fd51f5ee7750589b2e8a51406240178ce8632cdd57aa311f76
|
|
| MD5 |
45e31362cead1eac5d5031e1556da3a8
|
|
| BLAKE2b-256 |
7f984947037dc030a5bcd47a858ccf306834ad7deea7532579b42db430496af2
|
File details
Details for the file gsd-1.6.2-cp27-cp27m-manylinux1_x86_64.whl.
File metadata
- Download URL: gsd-1.6.2-cp27-cp27m-manylinux1_x86_64.whl
- Upload date:
- Size: 258.8 kB
- Tags: CPython 2.7m
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
283f43298000f7a8278df526d34255a0ebfa058b372da019fec9375f46af0f08
|
|
| MD5 |
8551f69e83e68451f05ea1c843a2e11c
|
|
| BLAKE2b-256 |
9bab6f55364263233a2364f5542de807e1dfc791b55e564c55d1016c95853948
|