跳转到主要内容

通用模拟数据文件格式。

项目描述

GSD

GSD 文件格式是 HOOMD-blue 的原生文件格式。 GSD 文件以二进制文件存储 HOOMD-blue 系统状态轨迹,并具有高效随机访问帧。 GSD 允许所有粒子和拓扑属性在帧之间变化。使用 GSD Python API 指定 HOOMD-blue 模拟的初始条件或使用脚本分析轨迹输出。使用可视化工具读取 GSD 轨迹以探索模拟的行为。

资源

  • GSD 文档:教程、Python API、C API、使用信息和格式规范。
  • 安装指南:安装和编译 GSD 的说明。
  • HOOMD-blue:读取和写入 GSD 文件的仿真引擎。
  • GSD 讨论板:向 GSD 社区寻求帮助。
  • freud:用于分析轨迹的强大工具集。
  • OVITO:与 GSD 文件兼容的开源可视化工具。
  • gsd-vmd 插件:支持 GSD 文件的 VMD 插件。

HOOMD 示例

创建 hoomd gsd 文件。

>>> 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)

将帧追加到 gsd 文件中

>>> 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

随机索引帧

>>> 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 ]]

切片帧

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

文件层示例

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);

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关 安装包 的更多信息。

源分布

gsd-3.3.2.tar.gz (182.3 kB 查看哈希值)

上传时间

构建分布

gsd-3.3.2-cp313-cp313-win_amd64.whl (251.6 kB 查看哈希值)

上传时间 CPython 3.13 Windows x86-64

gsd-3.3.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (639.9 kB 查看哈希值)

上传时间 CPython 3.13 manylinux: glibc 2.17+ x86-64

gsd-3.3.2-cp313-cp313-macosx_11_0_arm64.whl (253.5 kB 查看哈希值)

上传时间 CPython 3.13 macOS 11.0+ ARM64

gsd-3.3.2-cp313-cp313-macosx_10_13_x86_64.whl (257.2 kB 查看哈希值)

上传于 CPython 3.13 macOS 10.13+ x86-64

gsd-3.3.2-cp312-cp312-win_amd64.whl (252.4 kB 查看哈希值)

上传于 CPython 3.12 Windows x86-64

gsd-3.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (646.5 kB 查看哈希值)

上传于 CPython 3.12 manylinux: glibc 2.17+ x86-64

gsd-3.3.2-cp312-cp312-macosx_11_0_arm64.whl (255.0 kB 查看哈希值)

上传于 CPython 3.12 macOS 11.0+ ARM64

gsd-3.3.2-cp312-cp312-macosx_10_9_x86_64.whl (258.6 kB 查看哈希值)

上传于 CPython 3.12 macOS 10.9+ x86-64

gsd-3.3.2-cp311-cp311-win_amd64.whl (254.4 kB 查看哈希值)

上传于 CPython 3.11 Windows x86-64

gsd-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (643.2 kB 查看哈希值)

上传于 CPython 3.11 manylinux: glibc 2.17+ x86-64

gsd-3.3.2-cp311-cp311-macosx_11_0_arm64.whl (255.2 kB 查看哈希值)

上传于 CPython 3.11 macOS 11.0+ ARM64

gsd-3.3.2-cp311-cp311-macosx_10_9_x86_64.whl (259.9 kB 查看哈希值)

上传于 CPython 3.11 macOS 10.9+ x86-64

gsd-3.3.2-cp310-cp310-win_amd64.whl (254.3 kB 查看哈希值)

上传于 CPython 3.10 Windows x86-64

gsd-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (623.6 kB 查看哈希值)

上传于 CPython 3.10 manylinux: glibc 2.17+ x86-64

gsd-3.3.2-cp310-cp310-macosx_11_0_arm64.whl (255.1 kB 查看哈希值)

上传于 CPython 3.10 macOS 11.0+ ARM64

gsd-3.3.2-cp310-cp310-macosx_10_9_x86_64.whl (259.7 kB 查看哈希值)

上传于 CPython 3.10 macOS 10.9+ x86-64

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面