mdz 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. mdz-0.4.0/.clang-format +8 -0
  2. mdz-0.4.0/.gitattributes +9 -0
  3. mdz-0.4.0/.gitignore +37 -0
  4. mdz-0.4.0/CITATION.cff +23 -0
  5. mdz-0.4.0/CMakeLists.txt +178 -0
  6. mdz-0.4.0/LICENSE +21 -0
  7. mdz-0.4.0/PKG-INFO +90 -0
  8. mdz-0.4.0/README.md +65 -0
  9. mdz-0.4.0/THIRD_PARTY_LICENSES +157 -0
  10. mdz-0.4.0/bench/CMakeLists.txt +9 -0
  11. mdz-0.4.0/bench/bench_encode.cpp +131 -0
  12. mdz-0.4.0/bench/bench_files.cpp +226 -0
  13. mdz-0.4.0/bench/bench_vs_xtc.py +211 -0
  14. mdz-0.4.0/bench/benchmark.py +210 -0
  15. mdz-0.4.0/bench/gen_openmm.py +115 -0
  16. mdz-0.4.0/bench/lammps_rigid/README.md +11 -0
  17. mdz-0.4.0/bench/lammps_rigid/cluster.mol +35 -0
  18. mdz-0.4.0/bench/lammps_rigid/in.dump +15 -0
  19. mdz-0.4.0/bench/lammps_rigid/in.rigid +25 -0
  20. mdz-0.4.0/bindings/python/CMakeLists.txt +41 -0
  21. mdz-0.4.0/bindings/python/common.cpp +356 -0
  22. mdz-0.4.0/bindings/python/common.hpp +231 -0
  23. mdz-0.4.0/bindings/python/module.cpp +514 -0
  24. mdz-0.4.0/bindings/python/reader.cpp +370 -0
  25. mdz-0.4.0/bindings/python/writer.cpp +312 -0
  26. mdz-0.4.0/cli/CMakeLists.txt +9 -0
  27. mdz-0.4.0/cli/args.cpp +394 -0
  28. mdz-0.4.0/cli/args.hpp +77 -0
  29. mdz-0.4.0/cli/commands.cpp +725 -0
  30. mdz-0.4.0/cli/commands.hpp +13 -0
  31. mdz-0.4.0/cli/io.cpp +456 -0
  32. mdz-0.4.0/cli/io.hpp +97 -0
  33. mdz-0.4.0/cli/main.cpp +208 -0
  34. mdz-0.4.0/cli/signals.cpp +128 -0
  35. mdz-0.4.0/cli/signals.hpp +39 -0
  36. mdz-0.4.0/cli/tests/test_cli.py +410 -0
  37. mdz-0.4.0/cli/ui.cpp +144 -0
  38. mdz-0.4.0/cli/ui.hpp +67 -0
  39. mdz-0.4.0/cmake/deps.cmake +21 -0
  40. mdz-0.4.0/cmake/mdzConfig.cmake.in +7 -0
  41. mdz-0.4.0/cmake/zstd.cmake +58 -0
  42. mdz-0.4.0/docs/BENCHMARKS.md +223 -0
  43. mdz-0.4.0/docs/FORMAT.md +272 -0
  44. mdz-0.4.0/docs/USAGE.md +157 -0
  45. mdz-0.4.0/examples/compress_dcd.sh +36 -0
  46. mdz-0.4.0/examples/every-frame.dcd +0 -0
  47. mdz-0.4.0/examples/lammps/ch3cn_water.lammpstrj +3840 -0
  48. mdz-0.4.0/examples/lammps/nacl.lammpstrj +3126 -0
  49. mdz-0.4.0/examples/make_multicolumn.py +82 -0
  50. mdz-0.4.0/examples/traj.dcd +0 -0
  51. mdz-0.4.0/include/mdz/column.hpp +107 -0
  52. mdz-0.4.0/include/mdz/error.hpp +32 -0
  53. mdz-0.4.0/include/mdz/formats.hpp +144 -0
  54. mdz-0.4.0/include/mdz/frame_batch.hpp +164 -0
  55. mdz-0.4.0/include/mdz/mdz.h +362 -0
  56. mdz-0.4.0/include/mdz/mdz.hpp +32 -0
  57. mdz-0.4.0/include/mdz/metadata.hpp +47 -0
  58. mdz-0.4.0/include/mdz/options.hpp +83 -0
  59. mdz-0.4.0/include/mdz/reader.hpp +91 -0
  60. mdz-0.4.0/include/mdz/span.hpp +37 -0
  61. mdz-0.4.0/include/mdz/trajectory.hpp +172 -0
  62. mdz-0.4.0/include/mdz/units.hpp +52 -0
  63. mdz-0.4.0/include/mdz/writer.hpp +76 -0
  64. mdz-0.4.0/lammps/CMakeLists.txt +68 -0
  65. mdz-0.4.0/lammps/README.md +183 -0
  66. mdz-0.4.0/lammps/dump_mdz.cpp +478 -0
  67. mdz-0.4.0/lammps/dump_mdz.h +100 -0
  68. mdz-0.4.0/lammps/mdzplugin.cpp +33 -0
  69. mdz-0.4.0/lammps/tests/check.py +102 -0
  70. mdz-0.4.0/lammps/tests/in.rigid +24 -0
  71. mdz-0.4.0/lammps/tests/in.smoke +42 -0
  72. mdz-0.4.0/lammps/tests/in.variable +36 -0
  73. mdz-0.4.0/lammps/tests/run.sh +18 -0
  74. mdz-0.4.0/lammps/tests/tri.mol +15 -0
  75. mdz-0.4.0/pyproject.toml +63 -0
  76. mdz-0.4.0/python/mdz/__init__.py +109 -0
  77. mdz-0.4.0/python/mdz/_core.pyi +394 -0
  78. mdz-0.4.0/python/mdz/ovito_reader.py +163 -0
  79. mdz-0.4.0/python/mdz/py.typed +0 -0
  80. mdz-0.4.0/src/bytes.cpp +21 -0
  81. mdz-0.4.0/src/bytes.hpp +95 -0
  82. mdz-0.4.0/src/capi.cpp +762 -0
  83. mdz-0.4.0/src/codec.cpp +594 -0
  84. mdz-0.4.0/src/codec.hpp +94 -0
  85. mdz-0.4.0/src/column.cpp +116 -0
  86. mdz-0.4.0/src/columns.cpp +847 -0
  87. mdz-0.4.0/src/container.cpp +392 -0
  88. mdz-0.4.0/src/container.hpp +76 -0
  89. mdz-0.4.0/src/crc32.cpp +48 -0
  90. mdz-0.4.0/src/crc32.hpp +12 -0
  91. mdz-0.4.0/src/error.cpp +10 -0
  92. mdz-0.4.0/src/file_io.cpp +66 -0
  93. mdz-0.4.0/src/file_io.hpp +39 -0
  94. mdz-0.4.0/src/formats/dcd.cpp +442 -0
  95. mdz-0.4.0/src/formats/extxyz.cpp +564 -0
  96. mdz-0.4.0/src/formats/internal.hpp +70 -0
  97. mdz-0.4.0/src/formats/lammps.cpp +1017 -0
  98. mdz-0.4.0/src/formats/mdz_format.cpp +60 -0
  99. mdz-0.4.0/src/formats/npy.cpp +335 -0
  100. mdz-0.4.0/src/formats/pdb.cpp +443 -0
  101. mdz-0.4.0/src/formats/registry.cpp +156 -0
  102. mdz-0.4.0/src/formats/text.cpp +226 -0
  103. mdz-0.4.0/src/formats/text.hpp +181 -0
  104. mdz-0.4.0/src/formats/xtc.cpp +316 -0
  105. mdz-0.4.0/src/formats/xyz.cpp +198 -0
  106. mdz-0.4.0/src/frame_batch.cpp +400 -0
  107. mdz-0.4.0/src/kernels.cpp +98 -0
  108. mdz-0.4.0/src/kernels.hpp +73 -0
  109. mdz-0.4.0/src/library.cpp +7 -0
  110. mdz-0.4.0/src/mapped_file.cpp +115 -0
  111. mdz-0.4.0/src/mapped_file.hpp +34 -0
  112. mdz-0.4.0/src/metadata.cpp +208 -0
  113. mdz-0.4.0/src/options.cpp +71 -0
  114. mdz-0.4.0/src/parallel.cpp +70 -0
  115. mdz-0.4.0/src/parallel.hpp +19 -0
  116. mdz-0.4.0/src/predict.hpp +53 -0
  117. mdz-0.4.0/src/reader.cpp +180 -0
  118. mdz-0.4.0/src/rigid.cpp +525 -0
  119. mdz-0.4.0/src/rigid.hpp +48 -0
  120. mdz-0.4.0/src/streams.cpp +180 -0
  121. mdz-0.4.0/src/trajectory.cpp +86 -0
  122. mdz-0.4.0/src/units.cpp +92 -0
  123. mdz-0.4.0/src/variable.cpp +441 -0
  124. mdz-0.4.0/src/variable.hpp +22 -0
  125. mdz-0.4.0/src/writer.cpp +244 -0
  126. mdz-0.4.0/src/xdr3d.cpp +545 -0
  127. mdz-0.4.0/src/xdr3d.hpp +23 -0
  128. mdz-0.4.0/src/zstd.cpp +104 -0
  129. mdz-0.4.0/src/zstd.hpp +27 -0
  130. mdz-0.4.0/tests/consumer/CMakeLists.txt +16 -0
  131. mdz-0.4.0/tests/consumer/consumer.cpp +30 -0
  132. mdz-0.4.0/tests/cpp/CMakeLists.txt +25 -0
  133. mdz-0.4.0/tests/cpp/capi/CMakeLists.txt +14 -0
  134. mdz-0.4.0/tests/cpp/capi/test_capi.c +752 -0
  135. mdz-0.4.0/tests/cpp/fixtures/text/extxyz_full.extxyz +10 -0
  136. mdz-0.4.0/tests/cpp/fixtures/text/extxyz_min.extxyz +4 -0
  137. mdz-0.4.0/tests/cpp/fixtures/text/lammps_ch3cn1.lammpstrj +384 -0
  138. mdz-0.4.0/tests/cpp/fixtures/text/lammps_general.lammpstrj +11 -0
  139. mdz-0.4.0/tests/cpp/fixtures/text/lammps_internal.lammpstrj +28 -0
  140. mdz-0.4.0/tests/cpp/fixtures/text/lammps_internal_lj.lammpstrj +28 -0
  141. mdz-0.4.0/tests/cpp/fixtures/text/lammps_nacl1.lammpstrj +521 -0
  142. mdz-0.4.0/tests/cpp/fixtures/text/lammps_ortho.lammpstrj +10 -0
  143. mdz-0.4.0/tests/cpp/fixtures/text/lammps_time.lammpstrj +24 -0
  144. mdz-0.4.0/tests/cpp/fixtures/text/lammps_triclinic.lammpstrj +12 -0
  145. mdz-0.4.0/tests/cpp/fixtures/text/lammps_triclinic_metal.lammpstrj +12 -0
  146. mdz-0.4.0/tests/cpp/fixtures/text/pdb_single.pdb +5 -0
  147. mdz-0.4.0/tests/cpp/fixtures/text/pdb_topology.pdb +20 -0
  148. mdz-0.4.0/tests/cpp/fixtures/text/triclinic.extxyz +5 -0
  149. mdz-0.4.0/tests/cpp/fixtures/text/triclinic.pdb +5 -0
  150. mdz-0.4.0/tests/cpp/fixtures/text/triclinic.xyz +5 -0
  151. mdz-0.4.0/tests/cpp/fixtures/text/xyz_basic.xyz +10 -0
  152. mdz-0.4.0/tests/cpp/main.cpp +61 -0
  153. mdz-0.4.0/tests/cpp/test.hpp +60 -0
  154. mdz-0.4.0/tests/cpp/test_codec.cpp +188 -0
  155. mdz-0.4.0/tests/cpp/test_container.cpp +178 -0
  156. mdz-0.4.0/tests/cpp/test_formats_binary.cpp +635 -0
  157. mdz-0.4.0/tests/cpp/test_formats_text.cpp +783 -0
  158. mdz-0.4.0/tests/cpp/test_formats_variable.cpp +381 -0
  159. mdz-0.4.0/tests/cpp/test_golden.cpp +232 -0
  160. mdz-0.4.0/tests/cpp/test_kernels.cpp +69 -0
  161. mdz-0.4.0/tests/cpp/test_rigid.cpp +237 -0
  162. mdz-0.4.0/tests/cpp/test_variable.cpp +216 -0
  163. mdz-0.4.0/tests/cpp/test_writer.cpp +134 -0
  164. mdz-0.4.0/tests/test_formats.py +282 -0
  165. mdz-0.4.0/tests/test_mdz.py +379 -0
  166. mdz-0.4.0/tests/test_python_api.py +534 -0
  167. mdz-0.4.0/tests/test_variable_and_rigid.py +282 -0
@@ -0,0 +1,8 @@
1
+ BasedOnStyle: Google
2
+ IndentWidth: 4
3
+ ColumnLimit: 120
4
+ AccessModifierOffset: -4
5
+ AllowShortFunctionsOnASingleLine: All
6
+ DerivePointerAlignment: false
7
+ PointerAlignment: Left
8
+ SortIncludes: Never
@@ -0,0 +1,9 @@
1
+ *.dcd binary
2
+ *.mdz binary
3
+ *.xtc binary
4
+ *.npy binary
5
+
6
+ # Reference files are compared byte for byte; never convert their line endings.
7
+ tests/cpp/fixtures/** -text
8
+ tests/cpp/golden/** -text
9
+ examples/** -text
mdz-0.4.0/.gitignore ADDED
@@ -0,0 +1,37 @@
1
+ # Build artifacts
2
+ dist/
3
+ *.egg-info/
4
+
5
+ # Python
6
+ uv.lock
7
+ __pycache__/
8
+ *.pyc
9
+ *.pyo
10
+ .venv/
11
+ .pytest_cache/
12
+
13
+ # Compiled extensions
14
+ *.so
15
+ *.pyd
16
+ *.dylib
17
+
18
+ # IDE / editor
19
+ .vscode/
20
+ .idea/
21
+ *.swp
22
+ *.swo
23
+
24
+ # Large data directories
25
+ examples/olivine_nvt/
26
+
27
+ # Generated example outputs
28
+ test.mdz
29
+ examples/*.mdz
30
+ examples/*.xyz
31
+ examples/*.extxyz
32
+
33
+ # macOS
34
+ .DS_Store
35
+
36
+ # CMake build trees
37
+ build*/
mdz-0.4.0/CITATION.cff ADDED
@@ -0,0 +1,23 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use mdz in your research, please cite it using these metadata."
3
+ type: software
4
+ title: "mdz: molecular dynamics trajectory compression with fast random access"
5
+ abstract: >-
6
+ mdz compresses molecular dynamics trajectories (positions, velocities,
7
+ forces and per-frame data) using inter-frame prediction, adaptive
8
+ quantization and zstd, in groups of frames that are individually indexed
9
+ for fast random access. It provides a C++ library, a command-line tool,
10
+ Python bindings, a C API and a LAMMPS dump style.
11
+ authors:
12
+ - family-names: Spackman
13
+ given-names: Peter
14
+ email: peterspackman@fastmail.com
15
+ repository-code: "https://github.com/peterspackman/mdz"
16
+ url: "https://github.com/peterspackman/mdz"
17
+ license: MIT
18
+ version: 0.4.0
19
+ keywords:
20
+ - molecular dynamics
21
+ - trajectory
22
+ - compression
23
+ - random access
@@ -0,0 +1,178 @@
1
+ cmake_minimum_required(VERSION 3.18)
2
+ project(mdz VERSION 0.4.0 LANGUAGES C CXX)
3
+
4
+ # When mdz is built on its own it is the top-level project. When another
5
+ # project includes it with add_subdirectory, only the library is built.
6
+ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
7
+ set(MDZ_TOP_LEVEL ON)
8
+ else()
9
+ set(MDZ_TOP_LEVEL OFF)
10
+ endif()
11
+
12
+ option(MDZ_BUILD_CLI "Build the mdz command-line tool" ${MDZ_TOP_LEVEL})
13
+ option(MDZ_BUILD_TESTS "Build the C++ tests" ${MDZ_TOP_LEVEL})
14
+ option(MDZ_BUILD_BENCH "Build the benchmarks" ${MDZ_TOP_LEVEL})
15
+ option(MDZ_BUILD_PYTHON "Build the Python extension (nanobind)" OFF)
16
+ option(MDZ_UNITY_BUILD "Compile the library as a few large translation units" OFF)
17
+ option(MDZ_FUZZ "Build the fuzz targets (libFuzzer with clang)" OFF)
18
+ option(MDZ_SANITIZE "Build with address and undefined-behaviour sanitizers" OFF)
19
+ set(MDZ_ZSTD "fetch" CACHE STRING "Where zstd comes from: fetch (build 1.5.7 from source) or system")
20
+ set_property(CACHE MDZ_ZSTD PROPERTY STRINGS fetch system)
21
+
22
+ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
23
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
24
+ endif()
25
+
26
+ set(CMAKE_CXX_STANDARD 17)
27
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
28
+ set(CMAKE_CXX_EXTENSIONS OFF)
29
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
30
+
31
+ include(cmake/zstd.cmake)
32
+ include(cmake/deps.cmake)
33
+
34
+ # ---- library ---------------------------------------------------------------
35
+
36
+ set(MDZ_SOURCES
37
+ src/bytes.cpp
38
+ src/codec.cpp
39
+ src/column.cpp
40
+ src/columns.cpp
41
+ src/container.cpp
42
+ src/crc32.cpp
43
+ src/error.cpp
44
+ src/file_io.cpp
45
+ src/frame_batch.cpp
46
+ src/kernels.cpp
47
+ src/library.cpp
48
+ src/mapped_file.cpp
49
+ src/metadata.cpp
50
+ src/options.cpp
51
+ src/parallel.cpp
52
+ src/reader.cpp
53
+ src/rigid.cpp
54
+ src/trajectory.cpp
55
+ src/units.cpp
56
+ src/variable.cpp
57
+ src/writer.cpp
58
+ src/xdr3d.cpp
59
+ src/zstd.cpp
60
+ src/streams.cpp
61
+ src/formats/registry.cpp
62
+ src/formats/text.cpp
63
+ src/formats/mdz_format.cpp
64
+ src/formats/dcd.cpp
65
+ src/formats/xtc.cpp
66
+ src/formats/npy.cpp
67
+ src/formats/extxyz.cpp
68
+ src/formats/lammps.cpp
69
+ src/formats/pdb.cpp
70
+ src/formats/xyz.cpp
71
+ src/capi.cpp
72
+ )
73
+
74
+ add_library(mdz ${MDZ_SOURCES})
75
+ add_library(mdz::mdz ALIAS mdz)
76
+ target_include_directories(mdz
77
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
78
+ $<INSTALL_INTERFACE:include>
79
+ PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
80
+ target_include_directories(mdz SYSTEM PRIVATE ${MDZ_HEADER_DEPS})
81
+ if(MDZ_ZSTD STREQUAL "fetch")
82
+ # Compile zstd's objects into mdz rather than linking a separate library, so
83
+ # a static libmdz is self-contained and exports no extra target.
84
+ target_sources(mdz PRIVATE $<TARGET_OBJECTS:mdz_zstd>)
85
+ target_include_directories(mdz PRIVATE $<TARGET_PROPERTY:mdz_zstd,INTERFACE_INCLUDE_DIRECTORIES>)
86
+ target_compile_definitions(mdz PRIVATE $<TARGET_PROPERTY:mdz_zstd,INTERFACE_COMPILE_DEFINITIONS>)
87
+ else()
88
+ target_link_libraries(mdz PRIVATE ${MDZ_ZSTD_LINK})
89
+ if(MDZ_ZSTD_INCLUDE)
90
+ target_include_directories(mdz SYSTEM PRIVATE ${MDZ_ZSTD_INCLUDE})
91
+ endif()
92
+ endif()
93
+ find_package(Threads REQUIRED)
94
+ target_link_libraries(mdz PUBLIC Threads::Threads)
95
+ target_compile_definitions(mdz PRIVATE MDZ_VERSION_STRING="${PROJECT_VERSION}")
96
+ if(MDZ_UNITY_BUILD)
97
+ set_target_properties(mdz PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 8)
98
+ endif()
99
+
100
+ # Every target that does floating-point work on mdz data must round the same
101
+ # way, so fused multiply-adds and reassociation are disabled. The encoder
102
+ # predicts from its own reconstruction, and a decoder that rounds differently
103
+ # would drift from it.
104
+ function(mdz_strict_fp target)
105
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
106
+ target_compile_options(${target} PRIVATE -ffp-contract=off -fno-fast-math)
107
+ elseif(MSVC)
108
+ target_compile_options(${target} PRIVATE /fp:precise)
109
+ endif()
110
+ endfunction()
111
+
112
+ # fopen, strerror and getenv are standard C; MSVC deprecates them in favour of
113
+ # its _s variants. Applies to this directory tree only.
114
+ if(MSVC)
115
+ add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
116
+ endif()
117
+
118
+ function(mdz_warnings target)
119
+ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
120
+ target_compile_options(${target} PRIVATE -Wall -Wextra -Wpedantic -Wshadow -Wno-unused-parameter)
121
+ elseif(MSVC)
122
+ target_compile_options(${target} PRIVATE /W4 /permissive- /utf-8)
123
+ endif()
124
+ endfunction()
125
+
126
+ mdz_strict_fp(mdz)
127
+ mdz_warnings(mdz)
128
+
129
+ if(MDZ_SANITIZE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
130
+ add_compile_options(-fsanitize=address,undefined -fno-omit-frame-pointer)
131
+ add_link_options(-fsanitize=address,undefined)
132
+ target_compile_options(mdz PRIVATE -fsanitize=address,undefined -fno-omit-frame-pointer)
133
+ target_link_options(mdz PUBLIC -fsanitize=address,undefined)
134
+ endif()
135
+
136
+ # ---- tools, tests, bindings ------------------------------------------------
137
+
138
+ if(MDZ_BUILD_CLI)
139
+ add_subdirectory(cli)
140
+ endif()
141
+
142
+ if(MDZ_BUILD_TESTS)
143
+ enable_testing()
144
+ add_subdirectory(tests/cpp)
145
+ endif()
146
+
147
+ if(MDZ_FUZZ)
148
+ add_subdirectory(fuzz)
149
+ endif()
150
+
151
+ if(MDZ_BUILD_BENCH)
152
+ add_subdirectory(bench)
153
+ endif()
154
+
155
+ if(MDZ_BUILD_PYTHON)
156
+ add_subdirectory(bindings/python)
157
+ endif()
158
+
159
+ # ---- install ---------------------------------------------------------------
160
+
161
+ if(MDZ_TOP_LEVEL AND NOT SKBUILD)
162
+ include(GNUInstallDirs)
163
+ install(TARGETS mdz EXPORT mdzTargets
164
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
165
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
166
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
167
+ install(DIRECTORY include/mdz DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
168
+ install(EXPORT mdzTargets NAMESPACE mdz:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mdz)
169
+ include(CMakePackageConfigHelpers)
170
+ configure_package_config_file(cmake/mdzConfig.cmake.in
171
+ ${CMAKE_CURRENT_BINARY_DIR}/mdzConfig.cmake
172
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mdz)
173
+ write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/mdzConfigVersion.cmake
174
+ COMPATIBILITY SameMinorVersion)
175
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mdzConfig.cmake
176
+ ${CMAKE_CURRENT_BINARY_DIR}/mdzConfigVersion.cmake
177
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/mdz)
178
+ endif()
mdz-0.4.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Peter Spackman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
mdz-0.4.0/PKG-INFO ADDED
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: mdz
3
+ Version: 0.4.0
4
+ Summary: Molecular dynamics trajectory compression with fast random access
5
+ Keywords: molecular-dynamics,compression,trajectory,science
6
+ Author-Email: Peter Spackman <peterspackman@fastmail.com>
7
+ License-Expression: MIT AND BSD-3-Clause
8
+ License-File: LICENSE
9
+ License-File: THIRD_PARTY_LICENSES
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Programming Language :: C++
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
15
+ Classifier: Topic :: Scientific/Engineering :: Physics
16
+ Classifier: Topic :: System :: Archiving :: Compression
17
+ Project-URL: Homepage, https://github.com/peterspackman/mdz
18
+ Project-URL: Repository, https://github.com/peterspackman/mdz
19
+ Project-URL: Issues, https://github.com/peterspackman/mdz/issues
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: numpy>=1.24
22
+ Provides-Extra: test
23
+ Requires-Dist: pytest>=7.0; extra == "test"
24
+ Description-Content-Type: text/markdown
25
+
26
+ # mdz
27
+
28
+ mdz compresses molecular dynamics trajectories to a fixed maximum error
29
+ (0.005 Å by default, the same as XTC). Any frame can be read without
30
+ decompressing the rest of the file.
31
+
32
+ Frames are predicted from the ones before them, so files are 2.5-3.5x
33
+ smaller than XTC when frames are saved every few femtoseconds, and never
34
+ bigger than XTC. See [docs/BENCHMARKS.md](docs/BENCHMARKS.md).
35
+
36
+ mdz is a C++17 library with a command-line tool, Python bindings, a C API and
37
+ a [LAMMPS dump style](lammps/README.md). It reads and writes DCD, XTC, XYZ,
38
+ extended XYZ, PDB, LAMMPS dumps and `.npy`.
39
+
40
+ ## Install
41
+
42
+ ```bash
43
+ pip install mdz
44
+ ```
45
+
46
+ Prebuilt `mdz` binaries are on the
47
+ [releases page](https://github.com/peterspackman/mdz/releases). To build
48
+ from source you need CMake 3.18+ and a C++17 compiler:
49
+
50
+ ```bash
51
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
52
+ cmake --build build --parallel
53
+ ```
54
+
55
+ ## Usage
56
+
57
+ ```bash
58
+ mdz compress traj.dcd -o traj.mdz
59
+ mdz decompress traj.mdz -o traj.xtc
60
+ mdz extract traj.mdz 100:200 -o slice.pdb
61
+ mdz info traj.mdz
62
+ ```
63
+
64
+ ```python
65
+ import mdz
66
+
67
+ r = mdz.open("traj.mdz")
68
+ r[42] # one frame, (natoms, 3), in nm
69
+ r[1000:2000] # a range of frames
70
+
71
+ with mdz.Writer("out.mdz") as w:
72
+ for step, x in simulation():
73
+ w.write(x, step=step)
74
+ ```
75
+
76
+ [docs/USAGE.md](docs/USAGE.md) covers precision, units, lossless mode,
77
+ varying atom counts, rigid bodies and the C++ API.
78
+ [docs/FORMAT.md](docs/FORMAT.md) describes the file format.
79
+
80
+ ## Development
81
+
82
+ ```bash
83
+ ctest --test-dir build
84
+ MDZ_CLI=$PWD/build/cli/mdz python -m pytest cli/tests
85
+ pip install . && python -m pytest tests
86
+ ```
87
+
88
+ ## License
89
+
90
+ MIT. To cite mdz, see [CITATION.cff](CITATION.cff).
mdz-0.4.0/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # mdz
2
+
3
+ mdz compresses molecular dynamics trajectories to a fixed maximum error
4
+ (0.005 Å by default, the same as XTC). Any frame can be read without
5
+ decompressing the rest of the file.
6
+
7
+ Frames are predicted from the ones before them, so files are 2.5-3.5x
8
+ smaller than XTC when frames are saved every few femtoseconds, and never
9
+ bigger than XTC. See [docs/BENCHMARKS.md](docs/BENCHMARKS.md).
10
+
11
+ mdz is a C++17 library with a command-line tool, Python bindings, a C API and
12
+ a [LAMMPS dump style](lammps/README.md). It reads and writes DCD, XTC, XYZ,
13
+ extended XYZ, PDB, LAMMPS dumps and `.npy`.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ pip install mdz
19
+ ```
20
+
21
+ Prebuilt `mdz` binaries are on the
22
+ [releases page](https://github.com/peterspackman/mdz/releases). To build
23
+ from source you need CMake 3.18+ and a C++17 compiler:
24
+
25
+ ```bash
26
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
27
+ cmake --build build --parallel
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ```bash
33
+ mdz compress traj.dcd -o traj.mdz
34
+ mdz decompress traj.mdz -o traj.xtc
35
+ mdz extract traj.mdz 100:200 -o slice.pdb
36
+ mdz info traj.mdz
37
+ ```
38
+
39
+ ```python
40
+ import mdz
41
+
42
+ r = mdz.open("traj.mdz")
43
+ r[42] # one frame, (natoms, 3), in nm
44
+ r[1000:2000] # a range of frames
45
+
46
+ with mdz.Writer("out.mdz") as w:
47
+ for step, x in simulation():
48
+ w.write(x, step=step)
49
+ ```
50
+
51
+ [docs/USAGE.md](docs/USAGE.md) covers precision, units, lossless mode,
52
+ varying atom counts, rigid bodies and the C++ API.
53
+ [docs/FORMAT.md](docs/FORMAT.md) describes the file format.
54
+
55
+ ## Development
56
+
57
+ ```bash
58
+ ctest --test-dir build
59
+ MDZ_CLI=$PWD/build/cli/mdz python -m pytest cli/tests
60
+ pip install . && python -m pytest tests
61
+ ```
62
+
63
+ ## License
64
+
65
+ MIT. To cite mdz, see [CITATION.cff](CITATION.cff).
@@ -0,0 +1,157 @@
1
+ Third-party software compiled into the mdz library, command-line tool and
2
+ Python package. Their licenses follow.
3
+
4
+ --------------------------------------------------------------------------------
5
+ zstd 1.5.7
6
+ https://github.com/facebook/zstd
7
+ --------------------------------------------------------------------------------
8
+
9
+ BSD License
10
+
11
+ For Zstandard software
12
+
13
+ Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
14
+
15
+ Redistribution and use in source and binary forms, with or without modification,
16
+ are permitted provided that the following conditions are met:
17
+
18
+ * Redistributions of source code must retain the above copyright notice, this
19
+ list of conditions and the following disclaimer.
20
+
21
+ * Redistributions in binary form must reproduce the above copyright notice,
22
+ this list of conditions and the following disclaimer in the documentation
23
+ and/or other materials provided with the distribution.
24
+
25
+ * Neither the name Facebook, nor Meta, nor the names of its contributors may
26
+ be used to endorse or promote products derived from this software without
27
+ specific prior written permission.
28
+
29
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
32
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
33
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
36
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
+
40
+ --------------------------------------------------------------------------------
41
+ fast_float 8.0.2 (used under the MIT option of its MIT/Apache-2.0/BSL-1.0 license)
42
+ https://github.com/fastfloat/fast_float
43
+ --------------------------------------------------------------------------------
44
+
45
+ MIT License
46
+
47
+ Copyright (c) 2021 The fast_float authors
48
+
49
+ Permission is hereby granted, free of charge, to any
50
+ person obtaining a copy of this software and associated
51
+ documentation files (the "Software"), to deal in the
52
+ Software without restriction, including without
53
+ limitation the rights to use, copy, modify, merge,
54
+ publish, distribute, sublicense, and/or sell copies of
55
+ the Software, and to permit persons to whom the Software
56
+ is furnished to do so, subject to the following
57
+ conditions:
58
+
59
+ The above copyright notice and this permission notice
60
+ shall be included in all copies or substantial portions
61
+ of the Software.
62
+
63
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
64
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
65
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
66
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
67
+ SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
68
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
69
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
70
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
71
+ DEALINGS IN THE SOFTWARE.
72
+
73
+ --------------------------------------------------------------------------------
74
+ unordered_dense 4.5.0
75
+ https://github.com/martinus/unordered_dense
76
+ --------------------------------------------------------------------------------
77
+
78
+ MIT License
79
+
80
+ Copyright (c) 2022 Martin Leitner-Ankerl
81
+
82
+ Permission is hereby granted, free of charge, to any person obtaining a copy
83
+ of this software and associated documentation files (the "Software"), to deal
84
+ in the Software without restriction, including without limitation the rights
85
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
86
+ copies of the Software, and to permit persons to whom the Software is
87
+ furnished to do so, subject to the following conditions:
88
+
89
+ The above copyright notice and this permission notice shall be included in all
90
+ copies or substantial portions of the Software.
91
+
92
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
93
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
94
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
95
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
96
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
97
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
98
+ SOFTWARE.
99
+
100
+ --------------------------------------------------------------------------------
101
+ nanobind (Python package only)
102
+ https://github.com/wjakob/nanobind
103
+ --------------------------------------------------------------------------------
104
+
105
+ Copyright (c) 2022 Wenzel Jakob <wenzel.jakob@epfl.ch>, All rights reserved.
106
+
107
+ Redistribution and use in source and binary forms, with or without
108
+ modification, are permitted provided that the following conditions are met:
109
+
110
+ 1. Redistributions of source code must retain the above copyright notice, this
111
+ list of conditions and the following disclaimer.
112
+
113
+ 2. Redistributions in binary form must reproduce the above copyright notice,
114
+ this list of conditions and the following disclaimer in the documentation
115
+ and/or other materials provided with the distribution.
116
+
117
+ 3. Neither the name of the copyright holder nor the names of its contributors
118
+ may be used to endorse or promote products derived from this software
119
+ without specific prior written permission.
120
+
121
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
122
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
123
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
124
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
125
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
126
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
127
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
128
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
129
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
130
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
131
+
132
+ --------------------------------------------------------------------------------
133
+ robin-map, bundled with nanobind (Python package only)
134
+ https://github.com/Tessil/robin-map
135
+ --------------------------------------------------------------------------------
136
+
137
+ MIT License
138
+
139
+ Copyright (c) 2017 Thibaut Goetghebuer-Planchon <tessil@gmx.com>
140
+
141
+ Permission is hereby granted, free of charge, to any person obtaining a copy
142
+ of this software and associated documentation files (the "Software"), to deal
143
+ in the Software without restriction, including without limitation the rights
144
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
145
+ copies of the Software, and to permit persons to whom the Software is
146
+ furnished to do so, subject to the following conditions:
147
+
148
+ The above copyright notice and this permission notice shall be included in
149
+ all copies or substantial portions of the Software.
150
+
151
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
152
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
153
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
154
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
155
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
156
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
157
+ SOFTWARE.
@@ -0,0 +1,9 @@
1
+ add_executable(bench_encode bench_encode.cpp)
2
+ target_link_libraries(bench_encode PRIVATE mdz::mdz)
3
+ mdz_strict_fp(bench_encode)
4
+
5
+ add_executable(bench_files bench_files.cpp)
6
+ target_link_libraries(bench_files PRIVATE mdz::mdz)
7
+ # The raw-floats baseline uses the library's internal zstd wrapper.
8
+ target_include_directories(bench_files PRIVATE ${PROJECT_SOURCE_DIR}/src)
9
+ mdz_strict_fp(bench_files)