summaryrefslogtreecommitdiff
path: root/src/tests/compression
diff options
context:
space:
mode:
authorDaniel Spangberg <daniels@kemi.uu.se>2013-05-15 12:31:28 (GMT)
committerDaniel Spangberg <daniels@kemi.uu.se>2013-05-15 12:31:28 (GMT)
commit2882416b599514f5a7e60b07c6a20b53a32f9027 (patch)
treefe8fd58b5023c7835af4096f32389e7cb8aaa6bb /src/tests/compression
parent43f0748e4a4335e0eb9f81cc8a4728616ac08cf1 (diff)
Added tng_compress trajectory compression algorithms
Diffstat (limited to 'src/tests/compression')
-rw-r--r--src/tests/compression/CMakeLists.txt0
-rwxr-xr-xsrc/tests/compression/getfilesize.sh10
-rw-r--r--src/tests/compression/test1.h23
-rw-r--r--src/tests/compression/test10.h23
-rw-r--r--src/tests/compression/test11.h23
-rw-r--r--src/tests/compression/test12.h23
-rw-r--r--src/tests/compression/test13.h23
-rw-r--r--src/tests/compression/test14.h23
-rw-r--r--src/tests/compression/test15.h23
-rw-r--r--src/tests/compression/test16.h24
-rw-r--r--src/tests/compression/test17.h25
-rw-r--r--src/tests/compression/test18.h25
-rw-r--r--src/tests/compression/test19.h25
-rw-r--r--src/tests/compression/test2.h23
-rw-r--r--src/tests/compression/test20.h25
-rw-r--r--src/tests/compression/test21.h25
-rw-r--r--src/tests/compression/test22.h25
-rw-r--r--src/tests/compression/test23.h25
-rw-r--r--src/tests/compression/test24.h25
-rw-r--r--src/tests/compression/test25.h25
-rw-r--r--src/tests/compression/test26.h25
-rw-r--r--src/tests/compression/test27.h25
-rw-r--r--src/tests/compression/test28.h26
-rw-r--r--src/tests/compression/test29.h26
-rw-r--r--src/tests/compression/test3.h23
-rw-r--r--src/tests/compression/test30.h23
-rw-r--r--src/tests/compression/test31.h23
-rw-r--r--src/tests/compression/test32.h23
-rw-r--r--src/tests/compression/test33.h23
-rw-r--r--src/tests/compression/test34.h23
-rw-r--r--src/tests/compression/test35.h23
-rw-r--r--src/tests/compression/test36.h23
-rw-r--r--src/tests/compression/test37.h23
-rw-r--r--src/tests/compression/test38.h23
-rw-r--r--src/tests/compression/test39.h23
-rw-r--r--src/tests/compression/test4.h23
-rw-r--r--src/tests/compression/test40.h23
-rw-r--r--src/tests/compression/test41.h23
-rw-r--r--src/tests/compression/test42.h23
-rw-r--r--src/tests/compression/test43.h23
-rw-r--r--src/tests/compression/test44.h23
-rw-r--r--src/tests/compression/test45.h23
-rw-r--r--src/tests/compression/test46.h23
-rw-r--r--src/tests/compression/test47.h23
-rw-r--r--src/tests/compression/test48.h23
-rw-r--r--src/tests/compression/test49.h23
-rw-r--r--src/tests/compression/test5.h23
-rw-r--r--src/tests/compression/test50.h23
-rw-r--r--src/tests/compression/test51.h23
-rw-r--r--src/tests/compression/test52.h24
-rw-r--r--src/tests/compression/test53.h24
-rw-r--r--src/tests/compression/test54.h24
-rw-r--r--src/tests/compression/test55.h24
-rw-r--r--src/tests/compression/test56.h24
-rw-r--r--src/tests/compression/test57.h24
-rw-r--r--src/tests/compression/test6.h23
-rw-r--r--src/tests/compression/test7.h23
-rw-r--r--src/tests/compression/test8.h23
-rw-r--r--src/tests/compression/test9.h23
-rw-r--r--src/tests/compression/testsuite.c657
-rwxr-xr-xsrc/tests/compression/testsuite.sh33
61 files changed, 2046 insertions, 0 deletions
diff --git a/src/tests/compression/CMakeLists.txt b/src/tests/compression/CMakeLists.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/tests/compression/CMakeLists.txt
diff --git a/src/tests/compression/getfilesize.sh b/src/tests/compression/getfilesize.sh
new file mode 100755
index 0000000..6e7650b
--- /dev/null
+++ b/src/tests/compression/getfilesize.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+STARTTEST=1
+ENDTEST=57
+for testnum in $(seq $STARTTEST $ENDTEST); do
+ if [ -r test$testnum.tng ]; then
+ grep -v "EXPECTED_FILESIZE" test$testnum.h >tmp$$.h
+ echo "#define EXPECTED_FILESIZE" $(ls -l test$testnum.tng |awk '{print $5}'). >>tmp$$.h
+ mv tmp$$.h test$testnum.h
+ fi
+done
diff --git a/src/tests/compression/test1.h b/src/tests/compression/test1.h
new file mode 100644
index 0000000..ad802e0
--- /dev/null
+++ b/src/tests/compression/test1.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. Intra frame triple algorithm. Cubic cell."
+#define FILENAME "test1.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 1
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 1
+#define CODINGPARAMETER 0
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 2776230.
diff --git a/src/tests/compression/test10.h b/src/tests/compression/test10.h
new file mode 100644
index 0000000..471dcab
--- /dev/null
+++ b/src/tests/compression/test10.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Coding. Triple intraframe algorithm. Cubic cell."
+#define FILENAME "test10.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 3
+#define CODINGPARAMETER -1
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 2728492.
diff --git a/src/tests/compression/test11.h b/src/tests/compression/test11.h
new file mode 100644
index 0000000..b9d7039
--- /dev/null
+++ b/src/tests/compression/test11.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Coding. Triple one-to-one algorithm. Cubic cell."
+#define FILENAME "test11.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 7
+#define CODINGPARAMETER -1
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 4293415.
diff --git a/src/tests/compression/test12.h b/src/tests/compression/test12.h
new file mode 100644
index 0000000..5d692d8
--- /dev/null
+++ b/src/tests/compression/test12.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Coding. BWLZH interframe algorithm. Cubic cell."
+#define FILENAME "test12.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 8
+#define CODINGPARAMETER 0
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 894421.
diff --git a/src/tests/compression/test13.h b/src/tests/compression/test13.h
new file mode 100644
index 0000000..b650f91
--- /dev/null
+++ b/src/tests/compression/test13.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Coding. BWLZH intraframe algorithm. Cubic cell."
+#define FILENAME "test13.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 9
+#define CODINGPARAMETER 0
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 840246.
diff --git a/src/tests/compression/test14.h b/src/tests/compression/test14.h
new file mode 100644
index 0000000..0db6853
--- /dev/null
+++ b/src/tests/compression/test14.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Coding. XTC3 algorithm. Cubic cell."
+#define FILENAME "test14.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 10
+#define CODINGPARAMETER 0
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 1401016.
diff --git a/src/tests/compression/test15.h b/src/tests/compression/test15.h
new file mode 100644
index 0000000..35f94ba
--- /dev/null
+++ b/src/tests/compression/test15.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. Automatic selection of algorithms. Cubic cell."
+#define FILENAME "test15.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 1
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING -1
+#define INITIALCODINGPARAMETER -1
+#define CODING 1
+#define CODINGPARAMETER 0
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 2776230.
diff --git a/src/tests/compression/test16.h b/src/tests/compression/test16.h
new file mode 100644
index 0000000..5f972cb
--- /dev/null
+++ b/src/tests/compression/test16.h
@@ -0,0 +1,24 @@
+#define TESTNAME "Coding. Automatic selection of algorithms. Cubic cell."
+#define FILENAME "test16.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING -1
+#define INITIALCODINGPARAMETER -1
+#define CODING -1
+#define CODINGPARAMETER -1
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define SPEED 6
+#define EXPECTED_FILESIZE 838168.
diff --git a/src/tests/compression/test17.h b/src/tests/compression/test17.h
new file mode 100644
index 0000000..226e34c
--- /dev/null
+++ b/src/tests/compression/test17.h
@@ -0,0 +1,25 @@
+#define TESTNAME "Initial coding of velocities. Stopbits one-to-one . Cubic cell."
+#define FILENAME "test17.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 1
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 1
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER 0
+#define INITIALVELCODING 1
+#define INITIALVELCODINGPARAMETER -1
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 7336171.
diff --git a/src/tests/compression/test18.h b/src/tests/compression/test18.h
new file mode 100644
index 0000000..1248a6d
--- /dev/null
+++ b/src/tests/compression/test18.h
@@ -0,0 +1,25 @@
+#define TESTNAME "Initial coding of velocities. Triplet one-to-one. Cubic cell."
+#define FILENAME "test18.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 1
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 1
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER 0
+#define INITIALVELCODING 3
+#define INITIALVELCODINGPARAMETER -1
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 7089695.
diff --git a/src/tests/compression/test19.h b/src/tests/compression/test19.h
new file mode 100644
index 0000000..ac09bc2
--- /dev/null
+++ b/src/tests/compression/test19.h
@@ -0,0 +1,25 @@
+#define TESTNAME "Initial coding of velocities. BWLZH one-to-one. Cubic cell."
+#define FILENAME "test19.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 1
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 1
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER 0
+#define INITIALVELCODING 9
+#define INITIALVELCODINGPARAMETER 0
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 50
+#define EXPECTED_FILESIZE 208809.
diff --git a/src/tests/compression/test2.h b/src/tests/compression/test2.h
new file mode 100644
index 0000000..f2a0f9a
--- /dev/null
+++ b/src/tests/compression/test2.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. XTC2 algorithm. Cubic cell."
+#define FILENAME "test2.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 1
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER 0
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 2796171.
diff --git a/src/tests/compression/test20.h b/src/tests/compression/test20.h
new file mode 100644
index 0000000..7df8f09
--- /dev/null
+++ b/src/tests/compression/test20.h
@@ -0,0 +1,25 @@
+#define TESTNAME "Coding of velocities. Stopbit one-to-one. Cubic cell."
+#define FILENAME "test20.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 1
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 5
+#define CODINGPARAMETER 0
+#define INITIALVELCODING 1
+#define INITIALVELCODINGPARAMETER -1
+#define VELCODING 1
+#define VELCODINGPARAMETER -1
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 7237102.
diff --git a/src/tests/compression/test21.h b/src/tests/compression/test21.h
new file mode 100644
index 0000000..2ea2353
--- /dev/null
+++ b/src/tests/compression/test21.h
@@ -0,0 +1,25 @@
+#define TESTNAME "Coding of velocities. Triplet inter. Cubic cell."
+#define FILENAME "test21.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 1
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 5
+#define CODINGPARAMETER 0
+#define INITIALVELCODING 1
+#define INITIALVELCODINGPARAMETER -1
+#define VELCODING 2
+#define VELCODINGPARAMETER -1
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 6214307.
diff --git a/src/tests/compression/test22.h b/src/tests/compression/test22.h
new file mode 100644
index 0000000..8b16428
--- /dev/null
+++ b/src/tests/compression/test22.h
@@ -0,0 +1,25 @@
+#define TESTNAME "Coding of velocities. Triplet one-to-one. Cubic cell."
+#define FILENAME "test22.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 1
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 5
+#define CODINGPARAMETER 0
+#define INITIALVELCODING 1
+#define INITIALVELCODINGPARAMETER -1
+#define VELCODING 3
+#define VELCODINGPARAMETER -1
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 6988699.
diff --git a/src/tests/compression/test23.h b/src/tests/compression/test23.h
new file mode 100644
index 0000000..85025d6
--- /dev/null
+++ b/src/tests/compression/test23.h
@@ -0,0 +1,25 @@
+#define TESTNAME "Coding of velocities. Stopbit interframe. Cubic cell."
+#define FILENAME "test23.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 1
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 5
+#define CODINGPARAMETER 0
+#define INITIALVELCODING 1
+#define INITIALVELCODINGPARAMETER -1
+#define VELCODING 6
+#define VELCODINGPARAMETER -1
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 6494602.
diff --git a/src/tests/compression/test24.h b/src/tests/compression/test24.h
new file mode 100644
index 0000000..dae943c
--- /dev/null
+++ b/src/tests/compression/test24.h
@@ -0,0 +1,25 @@
+#define TESTNAME "Coding of velocities. BWLZH interframe. Cubic cell."
+#define FILENAME "test24.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 25
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 1
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 5
+#define CODINGPARAMETER 0
+#define INITIALVELCODING 1
+#define INITIALVELCODINGPARAMETER -1
+#define VELCODING 8
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 50
+#define EXPECTED_FILESIZE 153520.
diff --git a/src/tests/compression/test25.h b/src/tests/compression/test25.h
new file mode 100644
index 0000000..6145cb9
--- /dev/null
+++ b/src/tests/compression/test25.h
@@ -0,0 +1,25 @@
+#define TESTNAME "Coding of velocities. BWLZH one-to-one. Cubic cell."
+#define FILENAME "test25.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 25
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 1
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 5
+#define CODINGPARAMETER 0
+#define INITIALVELCODING 1
+#define INITIALVELCODINGPARAMETER -1
+#define VELCODING 9
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 50
+#define EXPECTED_FILESIZE 154753.
diff --git a/src/tests/compression/test26.h b/src/tests/compression/test26.h
new file mode 100644
index 0000000..74523ad
--- /dev/null
+++ b/src/tests/compression/test26.h
@@ -0,0 +1,25 @@
+#define TESTNAME "XTC2 algorithm. Orthorhombic cell."
+#define FILENAME "test26.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 5
+#define CODINGPARAMETER 0
+#define INITIALVELCODING 1
+#define INITIALVELCODINGPARAMETER -1
+#define VELCODING 9
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 20000
+#define INTMAX2 10000
+#define INTMAX3 30000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 2861948.
diff --git a/src/tests/compression/test27.h b/src/tests/compression/test27.h
new file mode 100644
index 0000000..30aea07
--- /dev/null
+++ b/src/tests/compression/test27.h
@@ -0,0 +1,25 @@
+#define TESTNAME "XTC3 algorithm. Orthorhombic cell."
+#define FILENAME "test27.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 10
+#define INITIALCODINGPARAMETER 0
+#define CODING 10
+#define CODINGPARAMETER 0
+#define INITIALVELCODING 1
+#define INITIALVELCODINGPARAMETER -1
+#define VELCODING 9
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 20000
+#define INTMAX2 10000
+#define INTMAX3 30000
+#define NFRAMES 200
+#define EXPECTED_FILESIZE 282600.
diff --git a/src/tests/compression/test28.h b/src/tests/compression/test28.h
new file mode 100644
index 0000000..995b81c
--- /dev/null
+++ b/src/tests/compression/test28.h
@@ -0,0 +1,26 @@
+#define TESTNAME "Initial coding. Autoselect algorithm. Repetitive molecule. Cubic cell."
+#define FILENAME "test28.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 1
+#define SCALE 0.1
+#define REGULAR
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING -1
+#define INITIALCODINGPARAMETER -1
+#define CODING 0
+#define CODINGPARAMETER 0
+#define INITIALVELCODING 0
+#define INITIALVELCODINGPARAMETER -1
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 1677619.
diff --git a/src/tests/compression/test29.h b/src/tests/compression/test29.h
new file mode 100644
index 0000000..f48f909
--- /dev/null
+++ b/src/tests/compression/test29.h
@@ -0,0 +1,26 @@
+#define TESTNAME "Position coding. Autoselect algorithm. Repetitive molecule. Cubic cell."
+#define FILENAME "test29.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define REGULAR
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING -1
+#define INITIALCODINGPARAMETER -1
+#define CODING -1
+#define CODINGPARAMETER -1
+#define INITIALVELCODING 0
+#define INITIALVELCODINGPARAMETER -1
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 228148.
diff --git a/src/tests/compression/test3.h b/src/tests/compression/test3.h
new file mode 100644
index 0000000..c4bbebd
--- /dev/null
+++ b/src/tests/compression/test3.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. Triplet one-to-one algorithm. Cubic cell."
+#define FILENAME "test3.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 1
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 7
+#define INITIALCODINGPARAMETER -1
+#define CODING 1
+#define CODINGPARAMETER 0
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 4356773.
diff --git a/src/tests/compression/test30.h b/src/tests/compression/test30.h
new file mode 100644
index 0000000..2ea607b
--- /dev/null
+++ b/src/tests/compression/test30.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. Intra frame triple algorithm. Large system. Cubic cell."
+#define FILENAME "test30.tng"
+#define ALGOTEST
+#define NATOMS 5000000
+#define CHUNKY 1
+#define SCALE 1.
+#define PRECISION 1.
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 1
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 -536870911
+#define INTMIN2 -536870911
+#define INTMIN3 -536870911
+#define INTMAX1 536870911
+#define INTMAX2 536870911
+#define INTMAX3 536870911
+#define NFRAMES 10
+#define EXPECTED_FILESIZE 280198420.
diff --git a/src/tests/compression/test31.h b/src/tests/compression/test31.h
new file mode 100644
index 0000000..d5d86d4
--- /dev/null
+++ b/src/tests/compression/test31.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. XTC2 algorithm. Large system. Cubic cell."
+#define FILENAME "test31.tng"
+#define ALGOTEST
+#define NATOMS 5000000
+#define CHUNKY 1
+#define SCALE 1.
+#define PRECISION 1.
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 -536870911
+#define INTMIN2 -536870911
+#define INTMIN3 -536870911
+#define INTMAX1 536870911
+#define INTMAX2 536870911
+#define INTMAX3 536870911
+#define NFRAMES 10
+#define EXPECTED_FILESIZE 301463456.
diff --git a/src/tests/compression/test32.h b/src/tests/compression/test32.h
new file mode 100644
index 0000000..7b66438
--- /dev/null
+++ b/src/tests/compression/test32.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. XTC3 algorithm. Large system. Cubic cell."
+#define FILENAME "test32.tng"
+#define ALGOTEST
+#define NATOMS 5000000
+#define CHUNKY 1
+#define SCALE 1.
+#define PRECISION 1.
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 10
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 -536870911
+#define INTMIN2 -536870911
+#define INTMIN3 -536870911
+#define INTMAX1 536870911
+#define INTMAX2 536870911
+#define INTMAX3 536870911
+#define NFRAMES 2
+#define EXPECTED_FILESIZE 31668187.
diff --git a/src/tests/compression/test33.h b/src/tests/compression/test33.h
new file mode 100644
index 0000000..9463eeb
--- /dev/null
+++ b/src/tests/compression/test33.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. Intra frame BWLZH algorithm. Large system. Cubic cell."
+#define FILENAME "test33.tng"
+#define ALGOTEST
+#define NATOMS 5000000
+#define CHUNKY 1
+#define SCALE 1.
+#define PRECISION 1.
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 9
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 -536870911
+#define INTMIN2 -536870911
+#define INTMIN3 -536870911
+#define INTMAX1 536870911
+#define INTMAX2 536870911
+#define INTMAX3 536870911
+#define NFRAMES 2
+#define EXPECTED_FILESIZE 7121047.
diff --git a/src/tests/compression/test34.h b/src/tests/compression/test34.h
new file mode 100644
index 0000000..14fe88f
--- /dev/null
+++ b/src/tests/compression/test34.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. Stop bits algorithm. Large system. Cubic cell."
+#define FILENAME "test34.tng"
+#define ALGOTEST
+#define NATOMS 5000000
+#define CHUNKY 2
+#define SCALE 1.
+#define PRECISION 1.
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 -536870911
+#define INTMIN2 -536870911
+#define INTMIN3 -536870911
+#define INTMAX1 536870911
+#define INTMAX2 536870911
+#define INTMAX3 536870911
+#define NFRAMES 10
+#define EXPECTED_FILESIZE 250247372.
diff --git a/src/tests/compression/test35.h b/src/tests/compression/test35.h
new file mode 100644
index 0000000..44af4c4
--- /dev/null
+++ b/src/tests/compression/test35.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. Inter frame triple algorithm. Large system. Cubic cell."
+#define FILENAME "test35.tng"
+#define ALGOTEST
+#define NATOMS 5000000
+#define CHUNKY 2
+#define SCALE 1.
+#define PRECISION 1.
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 2
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 -536870911
+#define INTMIN2 -536870911
+#define INTMIN3 -536870911
+#define INTMAX1 536870911
+#define INTMAX2 536870911
+#define INTMAX3 536870911
+#define NFRAMES 10
+#define EXPECTED_FILESIZE 243598962.
diff --git a/src/tests/compression/test36.h b/src/tests/compression/test36.h
new file mode 100644
index 0000000..56f5dcd
--- /dev/null
+++ b/src/tests/compression/test36.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. Intra frame triple algorithm. Large system. Cubic cell."
+#define FILENAME "test36.tng"
+#define ALGOTEST
+#define NATOMS 5000000
+#define CHUNKY 2
+#define SCALE 1.
+#define PRECISION 1.
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 3
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 -536870911
+#define INTMIN2 -536870911
+#define INTMIN3 -536870911
+#define INTMAX1 536870911
+#define INTMAX2 536870911
+#define INTMAX3 536870911
+#define NFRAMES 10
+#define EXPECTED_FILESIZE 290800607.
diff --git a/src/tests/compression/test37.h b/src/tests/compression/test37.h
new file mode 100644
index 0000000..68b4872
--- /dev/null
+++ b/src/tests/compression/test37.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. XTC2 algorithm. Large system. Cubic cell."
+#define FILENAME "test37.tng"
+#define ALGOTEST
+#define NATOMS 5000000
+#define CHUNKY 2
+#define SCALE 1.
+#define PRECISION 1.
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 5
+#define CODINGPARAMETER 0
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 -536870911
+#define INTMIN2 -536870911
+#define INTMIN3 -536870911
+#define INTMAX1 536870911
+#define INTMAX2 536870911
+#define INTMAX3 536870911
+#define NFRAMES 10
+#define EXPECTED_FILESIZE 301463256.
diff --git a/src/tests/compression/test38.h b/src/tests/compression/test38.h
new file mode 100644
index 0000000..7e43348
--- /dev/null
+++ b/src/tests/compression/test38.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. XTC3 algorithm. Large system. Cubic cell."
+#define FILENAME "test38.tng"
+#define ALGOTEST
+#define NATOMS 5000000
+#define CHUNKY 2
+#define SCALE 1.
+#define PRECISION 1.
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 10
+#define INITIALCODINGPARAMETER 0
+#define CODING 10
+#define CODINGPARAMETER 0
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 -536870911
+#define INTMIN2 -536870911
+#define INTMIN3 -536870911
+#define INTMAX1 536870911
+#define INTMAX2 536870911
+#define INTMAX3 536870911
+#define NFRAMES 4
+#define EXPECTED_FILESIZE 63482016.
diff --git a/src/tests/compression/test39.h b/src/tests/compression/test39.h
new file mode 100644
index 0000000..bb3ecc0
--- /dev/null
+++ b/src/tests/compression/test39.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. Intra frame BWLZH algorithm. Large system. Cubic cell."
+#define FILENAME "test39.tng"
+#define ALGOTEST
+#define NATOMS 5000000
+#define CHUNKY 2
+#define SCALE 1.
+#define PRECISION 1.
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 9
+#define CODINGPARAMETER 0
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 -536870911
+#define INTMIN2 -536870911
+#define INTMIN3 -536870911
+#define INTMAX1 536870911
+#define INTMAX2 536870911
+#define INTMAX3 536870911
+#define NFRAMES 4
+#define EXPECTED_FILESIZE 67631371.
diff --git a/src/tests/compression/test4.h b/src/tests/compression/test4.h
new file mode 100644
index 0000000..63ec9da
--- /dev/null
+++ b/src/tests/compression/test4.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. BWLZH one-to-one algorithm. Cubic cell."
+#define FILENAME "test4.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 1
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 9
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER 0
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 2572043.
diff --git a/src/tests/compression/test40.h b/src/tests/compression/test40.h
new file mode 100644
index 0000000..5eb9c0d
--- /dev/null
+++ b/src/tests/compression/test40.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. Inter frame BWLZH algorithm. Large system. Cubic cell."
+#define FILENAME "test40.tng"
+#define ALGOTEST
+#define NATOMS 5000000
+#define CHUNKY 2
+#define SCALE 1.
+#define PRECISION 1.
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 8
+#define CODINGPARAMETER 0
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 -536870911
+#define INTMIN2 -536870911
+#define INTMIN3 -536870911
+#define INTMAX1 536870911
+#define INTMAX2 536870911
+#define INTMAX3 536870911
+#define NFRAMES 4
+#define EXPECTED_FILESIZE 63822378.
diff --git a/src/tests/compression/test41.h b/src/tests/compression/test41.h
new file mode 100644
index 0000000..f673944
--- /dev/null
+++ b/src/tests/compression/test41.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. Intra frame triple algorithm. High accuracy. Cubic cell."
+#define FILENAME "test41.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 1
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 1
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 1610612736
+#define INTMAX2 1610612736
+#define INTMAX3 1610612736
+#define NFRAMES 100
+#define EXPECTED_FILESIZE 53179342.
diff --git a/src/tests/compression/test42.h b/src/tests/compression/test42.h
new file mode 100644
index 0000000..b40f963
--- /dev/null
+++ b/src/tests/compression/test42.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. XTC2 algorithm. High accuracy. Cubic cell."
+#define FILENAME "test42.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 1
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 1610612736
+#define INTMAX2 1610612736
+#define INTMAX3 1610612736
+#define NFRAMES 100
+#define EXPECTED_FILESIZE 57283715.
diff --git a/src/tests/compression/test43.h b/src/tests/compression/test43.h
new file mode 100644
index 0000000..38a59db
--- /dev/null
+++ b/src/tests/compression/test43.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. XTC3 algorithm. High accuracy. Cubic cell."
+#define FILENAME "test43.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 1
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 10
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 1610612736
+#define INTMAX2 1610612736
+#define INTMAX3 1610612736
+#define NFRAMES 10
+#define EXPECTED_FILESIZE 3783912.
diff --git a/src/tests/compression/test44.h b/src/tests/compression/test44.h
new file mode 100644
index 0000000..0bab871
--- /dev/null
+++ b/src/tests/compression/test44.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. Intra frame BWLZH algorithm. High accuracy. Cubic cell."
+#define FILENAME "test44.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 1
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 9
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 1610612736
+#define INTMAX2 1610612736
+#define INTMAX3 1610612736
+#define NFRAMES 10
+#define EXPECTED_FILESIZE 1436901.
diff --git a/src/tests/compression/test45.h b/src/tests/compression/test45.h
new file mode 100644
index 0000000..095efed
--- /dev/null
+++ b/src/tests/compression/test45.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. Stop bits algorithm. High accuracy. Cubic cell."
+#define FILENAME "test45.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 10
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 1
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 1610612736
+#define INTMAX2 1610612736
+#define INTMAX3 1610612736
+#define NFRAMES 100
+#define EXPECTED_FILESIZE 36794379.
diff --git a/src/tests/compression/test46.h b/src/tests/compression/test46.h
new file mode 100644
index 0000000..dc0b8bb
--- /dev/null
+++ b/src/tests/compression/test46.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. Inter frame triple algorithm. High accuracy. Cubic cell."
+#define FILENAME "test46.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 10
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 2
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 1610612736
+#define INTMAX2 1610612736
+#define INTMAX3 1610612736
+#define NFRAMES 100
+#define EXPECTED_FILESIZE 34508770.
diff --git a/src/tests/compression/test47.h b/src/tests/compression/test47.h
new file mode 100644
index 0000000..5a5182d
--- /dev/null
+++ b/src/tests/compression/test47.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. Intra frame triple algorithm. High accuracy. Cubic cell."
+#define FILENAME "test47.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 10
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 3
+#define CODINGPARAMETER -1
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 1610612736
+#define INTMAX2 1610612736
+#define INTMAX3 1610612736
+#define NFRAMES 100
+#define EXPECTED_FILESIZE 53174711.
diff --git a/src/tests/compression/test48.h b/src/tests/compression/test48.h
new file mode 100644
index 0000000..1562779
--- /dev/null
+++ b/src/tests/compression/test48.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. XTC2 algorithm. High accuracy. Cubic cell."
+#define FILENAME "test48.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 10
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 5
+#define CODINGPARAMETER 0
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 805306368
+#define INTMAX2 805306368
+#define INTMAX3 805306368
+#define NFRAMES 100
+#define EXPECTED_FILESIZE 55638414.
diff --git a/src/tests/compression/test49.h b/src/tests/compression/test49.h
new file mode 100644
index 0000000..dcad4ec
--- /dev/null
+++ b/src/tests/compression/test49.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. XTC3 algorithm. High accuracy. Cubic cell."
+#define FILENAME "test49.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 10
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 10
+#define CODINGPARAMETER 0
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 805306368
+#define INTMAX2 805306368
+#define INTMAX3 805306368
+#define NFRAMES 20
+#define EXPECTED_FILESIZE 3585605.
diff --git a/src/tests/compression/test5.h b/src/tests/compression/test5.h
new file mode 100644
index 0000000..a933044
--- /dev/null
+++ b/src/tests/compression/test5.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Initial coding. XTC3 algorithm. Cubic cell."
+#define FILENAME "test5.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 1
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 10
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER 0
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 3346179.
diff --git a/src/tests/compression/test50.h b/src/tests/compression/test50.h
new file mode 100644
index 0000000..a00e209
--- /dev/null
+++ b/src/tests/compression/test50.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. Intra frame BWLZH algorithm. High accuracy. Cubic cell."
+#define FILENAME "test50.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 10
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 9
+#define CODINGPARAMETER 0
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 805306368
+#define INTMAX2 805306368
+#define INTMAX3 805306368
+#define NFRAMES 20
+#define EXPECTED_FILESIZE 3143379.
diff --git a/src/tests/compression/test51.h b/src/tests/compression/test51.h
new file mode 100644
index 0000000..4641b61
--- /dev/null
+++ b/src/tests/compression/test51.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Position coding. Inter frame BWLZH algorithm. High accuracy. Cubic cell."
+#define FILENAME "test51.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 10
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 8
+#define CODINGPARAMETER 0
+#define VELCODING 4
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 805306368
+#define INTMAX2 805306368
+#define INTMAX3 805306368
+#define NFRAMES 20
+#define EXPECTED_FILESIZE 2897696.
diff --git a/src/tests/compression/test52.h b/src/tests/compression/test52.h
new file mode 100644
index 0000000..2f49a8b
--- /dev/null
+++ b/src/tests/compression/test52.h
@@ -0,0 +1,24 @@
+#define TESTNAME "Velocity coding. Stop bits algorithm. High accuracy. Cubic cell."
+#define FILENAME "test52.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 10
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 1
+#define VELINTMUL 100000
+#define VELPRECISION 1e-8
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 5
+#define CODINGPARAMETER 0
+#define VELCODING 1
+#define VELCODINGPARAMETER -1
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 805306368
+#define INTMAX2 805306368
+#define INTMAX3 805306368
+#define NFRAMES 100
+#define EXPECTED_FILESIZE 173083705.
diff --git a/src/tests/compression/test53.h b/src/tests/compression/test53.h
new file mode 100644
index 0000000..679b680
--- /dev/null
+++ b/src/tests/compression/test53.h
@@ -0,0 +1,24 @@
+#define TESTNAME "Velocity coding. Triple algorithm. High accuracy. Cubic cell."
+#define FILENAME "test53.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 10
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 1
+#define VELINTMUL 100000
+#define VELPRECISION 1e-8
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 5
+#define CODINGPARAMETER 0
+#define VELCODING 3
+#define VELCODINGPARAMETER -1
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 805306368
+#define INTMAX2 805306368
+#define INTMAX3 805306368
+#define NFRAMES 100
+#define EXPECTED_FILESIZE 168548573.
diff --git a/src/tests/compression/test54.h b/src/tests/compression/test54.h
new file mode 100644
index 0000000..c2c2869
--- /dev/null
+++ b/src/tests/compression/test54.h
@@ -0,0 +1,24 @@
+#define TESTNAME "Velocity coding. Interframe triple algorithm. High accuracy. Cubic cell."
+#define FILENAME "test54.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 10
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 1
+#define VELINTMUL 100000
+#define VELPRECISION 1e-8
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 5
+#define CODINGPARAMETER 0
+#define VELCODING 2
+#define VELCODINGPARAMETER -1
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 805306368
+#define INTMAX2 805306368
+#define INTMAX3 805306368
+#define NFRAMES 100
+#define EXPECTED_FILESIZE 161798573.
diff --git a/src/tests/compression/test55.h b/src/tests/compression/test55.h
new file mode 100644
index 0000000..a094d97
--- /dev/null
+++ b/src/tests/compression/test55.h
@@ -0,0 +1,24 @@
+#define TESTNAME "Velocity coding. Interframe stop-bits algorithm. High accuracy. Cubic cell."
+#define FILENAME "test55.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 10
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 1
+#define VELINTMUL 100000
+#define VELPRECISION 1e-8
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 5
+#define CODINGPARAMETER 0
+#define VELCODING 6
+#define VELCODINGPARAMETER -1
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 805306368
+#define INTMAX2 805306368
+#define INTMAX3 805306368
+#define NFRAMES 100
+#define EXPECTED_FILESIZE 166298533.
diff --git a/src/tests/compression/test56.h b/src/tests/compression/test56.h
new file mode 100644
index 0000000..6655ad0
--- /dev/null
+++ b/src/tests/compression/test56.h
@@ -0,0 +1,24 @@
+#define TESTNAME "Velocity coding. Intraframe BWLZH algorithm. High accuracy. Cubic cell."
+#define FILENAME "test56.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 10
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 1
+#define VELINTMUL 100000
+#define VELPRECISION 1e-8
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 5
+#define CODINGPARAMETER 0
+#define VELCODING 9
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 805306368
+#define INTMAX2 805306368
+#define INTMAX3 805306368
+#define NFRAMES 20
+#define EXPECTED_FILESIZE 23390767.
diff --git a/src/tests/compression/test57.h b/src/tests/compression/test57.h
new file mode 100644
index 0000000..2788e98
--- /dev/null
+++ b/src/tests/compression/test57.h
@@ -0,0 +1,24 @@
+#define TESTNAME "Velocity coding. Interframe BWLZH algorithm. High accuracy. Cubic cell."
+#define FILENAME "test57.tng"
+#define ALGOTEST
+#define NATOMS 100000
+#define CHUNKY 10
+#define SCALE 0.5
+#define PRECISION 1e-8
+#define WRITEVEL 1
+#define VELINTMUL 100000
+#define VELPRECISION 1e-8
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 5
+#define CODINGPARAMETER 0
+#define VELCODING 8
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 805306368
+#define INTMAX2 805306368
+#define INTMAX3 805306368
+#define NFRAMES 20
+#define EXPECTED_FILESIZE 13817974.
diff --git a/src/tests/compression/test6.h b/src/tests/compression/test6.h
new file mode 100644
index 0000000..cd3cfee
--- /dev/null
+++ b/src/tests/compression/test6.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Coding. XTC2 algorithm. Cubic cell."
+#define FILENAME "test6.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 5
+#define CODINGPARAMETER 0
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 2736662.
diff --git a/src/tests/compression/test7.h b/src/tests/compression/test7.h
new file mode 100644
index 0000000..90a2657
--- /dev/null
+++ b/src/tests/compression/test7.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Coding. Stopbit interframe algorithm. Cubic cell."
+#define FILENAME "test7.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 1
+#define CODINGPARAMETER -1
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 2545049.
diff --git a/src/tests/compression/test8.h b/src/tests/compression/test8.h
new file mode 100644
index 0000000..5a21053
--- /dev/null
+++ b/src/tests/compression/test8.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Coding. Stopbit interframe algorithm with intraframe compression as initial. Cubic cell."
+#define FILENAME "test8.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 3
+#define INITIALCODINGPARAMETER -1
+#define CODING 1
+#define CODINGPARAMETER -1
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 2544876.
diff --git a/src/tests/compression/test9.h b/src/tests/compression/test9.h
new file mode 100644
index 0000000..1247beb
--- /dev/null
+++ b/src/tests/compression/test9.h
@@ -0,0 +1,23 @@
+#define TESTNAME "Coding. Triple interframe algorithm. Cubic cell."
+#define FILENAME "test9.tng"
+#define ALGOTEST
+#define NATOMS 1000
+#define CHUNKY 100
+#define SCALE 0.1
+#define PRECISION 0.01
+#define WRITEVEL 0
+#define VELPRECISION 0.1
+#define INITIALCODING 5
+#define INITIALCODINGPARAMETER 0
+#define CODING 2
+#define CODINGPARAMETER -1
+#define VELCODING 0
+#define VELCODINGPARAMETER 0
+#define INTMIN1 0
+#define INTMIN2 0
+#define INTMIN3 0
+#define INTMAX1 10000
+#define INTMAX2 10000
+#define INTMAX3 10000
+#define NFRAMES 1000
+#define EXPECTED_FILESIZE 2418212.
diff --git a/src/tests/compression/testsuite.c b/src/tests/compression/testsuite.c
new file mode 100644
index 0000000..1c5b613
--- /dev/null
+++ b/src/tests/compression/testsuite.c
@@ -0,0 +1,657 @@
+/* tng compression routines */
+
+/* Only modify testsuite.c
+ *Then* run testsuite.sh to perform the test.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <tng_compress.h>
+#include <warnmalloc.h>
+#include TESTPARAM
+
+#define FUDGE 1.1 /* 10% off target precision is acceptable */
+
+static void keepinbox(int *val)
+{
+ while (val[0]>INTMAX1)
+ val[0]-=(INTMAX1-INTMIN1+1);
+ while (val[0]<INTMIN1)
+ val[0]+=(INTMAX1-INTMIN1+1);
+ while (val[1]>INTMAX2)
+ val[1]-=(INTMAX2-INTMIN2+1);
+ while (val[1]<INTMIN2)
+ val[1]+=(INTMAX2-INTMIN2+1);
+ while (val[2]>INTMAX3)
+ val[2]-=(INTMAX3-INTMIN3+1);
+ while (val[2]<INTMIN3)
+ val[2]+=(INTMAX3-INTMIN3+1);
+}
+
+static int intsintable[128]={
+0 , 3215 , 6423 , 9615 , 12785 , 15923 , 19023 , 22078 ,
+25079 , 28019 , 30892 , 33691 , 36409 , 39039 , 41574 , 44010 ,
+46340 , 48558 , 50659 , 52638 , 54490 , 56211 , 57796 , 59242 ,
+60546 , 61704 , 62713 , 63570 , 64275 , 64825 , 65219 , 65456 ,
+65535 , 65456 , 65219 , 64825 , 64275 , 63570 , 62713 , 61704 ,
+60546 , 59242 , 57796 , 56211 , 54490 , 52638 , 50659 , 48558 ,
+46340 , 44010 , 41574 , 39039 , 36409 , 33691 , 30892 , 28019 ,
+25079 , 22078 , 19023 , 15923 , 12785 , 9615 , 6423 , 3215 ,
+0 , -3215 , -6423 , -9615 , -12785 , -15923 , -19023 , -22078 ,
+-25079 , -28019 , -30892 , -33691 , -36409 , -39039 , -41574 , -44010 ,
+-46340 , -48558 , -50659 , -52638 , -54490 , -56211 , -57796 , -59242 ,
+-60546 , -61704 , -62713 , -63570 , -64275 , -64825 , -65219 , -65456 ,
+-65535 , -65456 , -65219 , -64825 , -64275 , -63570 , -62713 , -61704 ,
+-60546 , -59242 , -57796 , -56211 , -54490 , -52638 , -50659 , -48558 ,
+-46340 , -44010 , -41574 , -39039 , -36409 , -33691 , -30892 , -28019 ,
+-25079 , -22078 , -19023 , -15923 , -12785 , -9615 , -6423 , -3215 ,
+};
+
+static int intsin(int i)
+{
+ int sign=1;
+ if (i<0)
+ {
+ i=0;
+ sign=-1;
+ }
+ return sign*intsintable[i%128];
+}
+
+static int intcos(int i)
+{
+ if (i<0)
+ i=0;
+ return intsin(i+32);
+}
+
+static void molecule(int *target,
+ int *base,
+ int length,
+ int scale, int *direction,
+ int flip,
+ int iframe)
+{
+ int i;
+ for (i=0; i<length; i++)
+ {
+ int ifl=i;
+ if ((i==0) && (flip) && (length>1))
+ ifl=1;
+ else if ((i==1) && (flip) && (length>1))
+ ifl=0;
+ target[ifl*3]=base[0]+(intsin((i+iframe)*direction[0])*scale)/256;
+ target[ifl*3+1]=base[1]+(intcos((i+iframe)*direction[1])*scale)/256;
+ target[ifl*3+2]=base[2]+(intcos((i+iframe)*direction[2])*scale)/256;
+ keepinbox(target+ifl*3);
+ }
+}
+
+#ifndef FRAMESCALE
+#define FRAMESCALE 1
+#endif
+
+static void genibox(int *intbox, int iframe)
+{
+ int molecule_length=1;
+ int molpos[3];
+ int direction[3]={1,1,1};
+ int scale=1;
+ int flip=0;
+ int i=0;
+ molpos[0]=intsin(iframe*FRAMESCALE)/32;
+ molpos[1]=1+intcos(iframe*FRAMESCALE)/32;
+ molpos[2]=2+intsin(iframe*FRAMESCALE)/16;
+ keepinbox(molpos);
+ while (i<NATOMS)
+ {
+ int this_mol_length=molecule_length;
+ int dir;
+#ifdef REGULAR
+ this_mol_length=4;
+ flip=0;
+ scale=1;
+#endif
+ if (i+this_mol_length>NATOMS)
+ this_mol_length=NATOMS-i;
+ /* We must test the large rle as well. This requires special
+ sequencies to get triggered. So insert these from time to
+ time */
+#ifndef REGULAR
+ if ((i%10)==0)
+ {
+ int j;
+ intbox[i*3]=molpos[0];
+ intbox[i*3+1]=molpos[1];
+ intbox[i*3+2]=molpos[2];
+ for (j=1; j<this_mol_length; j++)
+ {
+ intbox[(i+j)*3]=intbox[(i+j-1)*3]+(INTMAX1-INTMIN1+1)/5;
+ intbox[(i+j)*3+1]=intbox[(i+j-1)*3+1]+(INTMAX2-INTMIN2+1)/5;
+ intbox[(i+j)*3+2]=intbox[(i+j-1)*3+2]+(INTMAX3-INTMIN3+1)/5;
+ keepinbox(intbox+(i+j)*3);
+ }
+ }
+ else
+#endif
+ molecule(intbox+i*3,molpos,this_mol_length,scale,direction,flip,iframe*FRAMESCALE);
+ i+=this_mol_length;
+ dir=1;
+ if (intsin(i*3)<0)
+ dir=-1;
+ molpos[0]+=dir*(INTMAX1-INTMIN1+1)/20;
+ dir=1;
+ if (intsin(i*5)<0)
+ dir=-1;
+ molpos[1]+=dir*(INTMAX2-INTMIN2+1)/20;
+ dir=1;
+ if (intsin(i*7)<0)
+ dir=-1;
+ molpos[2]+=dir*(INTMAX3-INTMIN3+1)/20;
+ keepinbox(molpos);
+
+ direction[0]=((direction[0]+1)%7)+1;
+ direction[1]=((direction[1]+1)%3)+1;
+ direction[2]=((direction[2]+1)%6)+1;
+
+ scale++;
+ if (scale>5)
+ scale=1;
+
+ molecule_length++;
+ if (molecule_length>30)
+ molecule_length=1;
+ if (i%9)
+ flip=1-flip;
+ }
+}
+
+static void genivelbox(int *intvelbox, int iframe)
+{
+ int i;
+ for (i=0; i<NATOMS; i++)
+ {
+#ifdef VELINTMUL
+ intvelbox[i*3]=((intsin((i+iframe*FRAMESCALE)*3))/10)*VELINTMUL+i;
+ intvelbox[i*3+1]=1+((intcos((i+iframe*FRAMESCALE)*5))/10)*VELINTMUL+i;
+ intvelbox[i*3+2]=2+((intsin((i+iframe*FRAMESCALE)*7)+intcos((i+iframe*FRAMESCALE)*9))/20)*VELINTMUL+i;
+#else
+ intvelbox[i*3]=((intsin((i+iframe*FRAMESCALE)*3))/10);
+ intvelbox[i*3+1]=1+((intcos((i+iframe*FRAMESCALE)*5))/10);
+ intvelbox[i*3+2]=2+((intsin((i+iframe*FRAMESCALE)*7)+intcos((i+iframe*FRAMESCALE)*9))/20);
+#endif
+ }
+}
+
+#ifndef STRIDE1
+#define STRIDE1 3
+#endif
+
+#ifndef STRIDE2
+#define STRIDE2 3
+#endif
+
+#ifndef GENPRECISION
+#define GENPRECISION PRECISION
+#endif
+
+#ifndef GENVELPRECISION
+#define GENVELPRECISION VELPRECISION
+#endif
+
+static void realbox(int *intbox, double *realbox, int stride)
+{
+ int i,j;
+ for (i=0; i<NATOMS; i++)
+ {
+ for (j=0; j<3; j++)
+ realbox[i*stride+j]=(double)(intbox[i*3+j]*GENPRECISION*SCALE);
+ for (j=3; j<stride; j++)
+ realbox[i*stride+j]=0.;
+ }
+}
+
+static void realvelbox(int *intbox, double *realbox, int stride)
+{
+ int i,j;
+ for (i=0; i<NATOMS; i++)
+ {
+ for (j=0; j<3; j++)
+ realbox[i*stride+j]=(double)(intbox[i*3+j]*GENVELPRECISION*SCALE);
+ for (j=3; j<stride; j++)
+ realbox[i*stride+j]=0.;
+ }
+}
+
+static int equalarr(double *arr1, double *arr2, double prec, int len, int itemlen, int stride1, int stride2)
+{
+ double maxdiff=0.;
+ int i,j;
+ for (i=0; i<len; i++)
+ {
+ for (j=0; j<itemlen; j++)
+ if (fabs(arr1[i*stride1+j]-arr2[i*stride2+j])>maxdiff)
+ maxdiff=(double)fabs(arr1[i*stride1+j]-arr2[i*stride2+j]);
+ }
+#if 0
+ for (i=0; i<len; i++)
+ {
+ for (j=0; j<itemlen; j++)
+ printf("%d %d: %g %g\n",i,j,arr1[i*stride1+j],arr2[i*stride2+j]);
+ }
+#endif
+#if 0
+ fprintf(stderr,"Error is %g. Acceptable error is %g.\n",maxdiff,prec*0.5*FUDGE);
+#endif
+ if (maxdiff>prec*0.5*FUDGE)
+ {
+ return 0;
+ }
+ else
+ return 1;
+}
+
+struct tng_file
+{
+ FILE *f;
+ int natoms;
+ int chunky;
+ double precision;
+ double velprecision;
+ int initial_coding;
+ int initial_coding_parameter;
+ int coding;
+ int coding_parameter;
+ int initial_velcoding;
+ int initial_velcoding_parameter;
+ int velcoding;
+ int velcoding_parameter;
+ int speed;
+ int nframes;
+ int nframes_delivered;
+ int writevel;
+ double *pos;
+ double *vel;
+};
+
+static size_t fwrite_int_le(int *x,FILE *f)
+{
+ unsigned char c[4];
+ unsigned int i=(unsigned int)*x;
+ c[0]=(unsigned char)(i&0xFFU);
+ c[1]=(unsigned char)((i>>8)&0xFFU);
+ c[2]=(unsigned char)((i>>16)&0xFFU);
+ c[3]=(unsigned char)((i>>24)&0xFFU);
+ return fwrite(c,1,4,f);
+}
+
+static size_t fread_int_le(int *x,FILE *f)
+{
+ unsigned char c[4];
+ unsigned int i;
+ size_t n=fread(c,1,4,f);
+ if (n)
+ {
+ i=(((unsigned int)c[3])<<24)|(((unsigned int)c[2])<<16)|(((unsigned int)c[1])<<8)|((unsigned int)c[0]);
+ *x=(int)i;
+ }
+ return n;
+}
+
+static struct tng_file *open_tng_file_write(char *filename,
+ int natoms,int chunky,
+ double precision,
+ int writevel,
+ double velprecision,
+ int initial_coding,
+ int initial_coding_parameter,
+ int coding,
+ int coding_parameter,
+ int initial_velcoding,
+ int initial_velcoding_parameter,
+ int velcoding,
+ int velcoding_parameter,
+ int speed)
+{
+ struct tng_file *tng_file=malloc(sizeof *tng_file);
+ tng_file->pos=NULL;
+ tng_file->vel=NULL;
+ tng_file->nframes=0;
+ tng_file->chunky=chunky;
+ tng_file->precision=precision;
+ tng_file->natoms=natoms;
+ tng_file->writevel=writevel;
+ tng_file->velprecision=velprecision;
+ tng_file->initial_coding=initial_coding;
+ tng_file->initial_coding_parameter=initial_coding_parameter;
+ tng_file->coding=coding;
+ tng_file->coding_parameter=coding_parameter;
+ tng_file->initial_velcoding=initial_velcoding;
+ tng_file->initial_velcoding_parameter=initial_velcoding_parameter;
+ tng_file->velcoding=velcoding;
+ tng_file->velcoding_parameter=velcoding_parameter;
+ tng_file->speed=speed;
+ tng_file->pos=malloc(natoms*chunky*3*sizeof *tng_file->pos);
+ tng_file->f=fopen(filename,"wb");
+ if (writevel)
+ tng_file->vel=malloc(natoms*chunky*3*sizeof *tng_file->vel);
+ fwrite_int_le(&natoms,tng_file->f);
+ return tng_file;
+}
+
+static void flush_tng_frames(struct tng_file *tng_file)
+{
+ int algo[4];
+ char *buf;
+ int nitems;
+ fwrite_int_le(&tng_file->nframes,tng_file->f);
+ algo[0]=tng_file->initial_coding;
+ algo[1]=tng_file->initial_coding_parameter;
+ algo[2]=tng_file->coding;
+ algo[3]=tng_file->coding_parameter;
+ buf=tng_compress_pos(tng_file->pos,
+ tng_file->natoms,
+ tng_file->nframes,
+ tng_file->precision,
+ tng_file->speed,algo,&nitems);
+ tng_file->initial_coding=algo[0];
+ tng_file->initial_coding_parameter=algo[1];
+ tng_file->coding=algo[2];
+ tng_file->coding_parameter=algo[3];
+ fwrite_int_le(&nitems,tng_file->f);
+ fwrite(buf,1,nitems,tng_file->f);
+ free(buf);
+ if (tng_file->writevel)
+ {
+ algo[0]=tng_file->initial_velcoding;
+ algo[1]=tng_file->initial_velcoding_parameter;
+ algo[2]=tng_file->velcoding;
+ algo[3]=tng_file->velcoding_parameter;
+ buf=tng_compress_vel(tng_file->vel,
+ tng_file->natoms,
+ tng_file->nframes,
+ tng_file->velprecision,
+ tng_file->speed,algo,&nitems);
+ tng_file->initial_velcoding=algo[0];
+ tng_file->initial_velcoding_parameter=algo[1];
+ tng_file->velcoding=algo[2];
+ tng_file->velcoding_parameter=algo[3];
+ fwrite_int_le(&nitems,tng_file->f);
+ fwrite(buf,1,nitems,tng_file->f);
+ free(buf);
+ }
+ tng_file->nframes=0;
+}
+
+static void write_tng_file(struct tng_file *tng_file,
+ double *pos,double *vel)
+{
+ memcpy(tng_file->pos+tng_file->nframes*tng_file->natoms*3,pos,tng_file->natoms*3*sizeof *tng_file->pos);
+ if (tng_file->writevel)
+ memcpy(tng_file->vel+tng_file->nframes*tng_file->natoms*3,vel,tng_file->natoms*3*sizeof *tng_file->vel);
+ tng_file->nframes++;
+ if (tng_file->nframes==tng_file->chunky)
+ flush_tng_frames(tng_file);
+}
+
+static void close_tng_file_write(struct tng_file *tng_file)
+{
+ if (tng_file->nframes)
+ flush_tng_frames(tng_file);
+ fclose(tng_file->f);
+ free(tng_file->pos);
+ free(tng_file->vel);
+ free(tng_file);
+}
+
+static struct tng_file *open_tng_file_read(char *filename, int writevel)
+{
+ struct tng_file *tng_file=malloc(sizeof *tng_file);
+ tng_file->pos=NULL;
+ tng_file->vel=NULL;
+ tng_file->f=fopen(filename,"rb");
+ tng_file->nframes=0;
+ tng_file->nframes_delivered=0;
+ tng_file->writevel=writevel;
+ fread_int_le(&tng_file->natoms,tng_file->f);
+ return tng_file;
+}
+
+static int read_tng_file(struct tng_file *tng_file,
+ double *pos,
+ double *vel)
+{
+ if (tng_file->nframes==tng_file->nframes_delivered)
+ {
+ int nitems;
+ char *buf;
+ free(tng_file->pos);
+ free(tng_file->vel);
+ if (!fread_int_le(&tng_file->nframes,tng_file->f))
+ return 1;
+ if (!fread_int_le(&nitems,tng_file->f))
+ return 1;
+ buf=malloc(nitems);
+ if (!fread(buf,1,nitems,tng_file->f))
+ return 1;
+ tng_file->pos=malloc(tng_file->natoms*tng_file->nframes*3*sizeof *tng_file->pos);
+ if (tng_file->writevel)
+ tng_file->vel=malloc(tng_file->natoms*tng_file->nframes*3*sizeof *tng_file->vel);
+#if 0
+ {
+ int natoms, nframes, algo[4];
+ double precision;
+ int ivel;
+ char *initial_coding, *coding;
+ tng_compress_inquire(buf,&ivel,&natoms,&nframes,&precision,algo);
+ initial_coding=tng_compress_initial_pos_algo(algo);
+ coding=tng_compress_pos_algo(algo);
+ printf("ivel=%d natoms=%d nframes=%d precision=%g initial pos=%s pos=%s\n",ivel,natoms,nframes,precision,initial_coding,coding);
+ }
+#endif
+ tng_compress_uncompress(buf,tng_file->pos);
+ free(buf);
+ if (tng_file->writevel)
+ {
+ if (!fread_int_le(&nitems,tng_file->f))
+ return 1;
+ buf=malloc(nitems);
+ if (!fread(buf,1,nitems,tng_file->f))
+ return 1;
+#if 0
+ {
+ int natoms, nframes, algo[4];
+ double precision;
+ int ivel;
+ char *initial_coding, *coding;
+ tng_compress_inquire(buf,&ivel,&natoms,&nframes,&precision,algo);
+ initial_coding=tng_compress_initial_vel_algo(algo);
+ coding=tng_compress_vel_algo(algo);
+ printf("ivel=%d natoms=%d nframes=%d precision=%g initial vel=%s vel=%s\n",ivel,natoms,nframes,precision,initial_coding,coding);
+ }
+#endif
+ tng_compress_uncompress(buf,tng_file->vel);
+ free(buf);
+ }
+ tng_file->nframes_delivered=0;
+ }
+ memcpy(pos,tng_file->pos+tng_file->nframes_delivered*tng_file->natoms*3,tng_file->natoms*3*sizeof *pos);
+ if (tng_file->writevel)
+ memcpy(vel,tng_file->vel+tng_file->nframes_delivered*tng_file->natoms*3,tng_file->natoms*3*sizeof *vel);
+ tng_file->nframes_delivered++;
+ return 0;
+}
+
+static void close_tng_file_read(struct tng_file *tng_file)
+{
+ free(tng_file->vel);
+ free(tng_file->pos);
+ fclose(tng_file->f);
+ free(tng_file);
+}
+
+
+
+#ifndef EXPECTED_FILESIZE
+#define EXPECTED_FILESIZE 1
+#endif
+
+#ifndef INITIALVELCODING
+#define INITIALVELCODING -1
+#endif
+#ifndef INITIALVELCODINGPARAMETER
+#define INITIALVELCODINGPARAMETER -1
+#endif
+
+#ifndef SPEED
+#define SPEED 5
+#endif
+
+/* Return value 1 means file error.
+ Return value 4 means coding error in coordinates.
+ Return value 5 means coding error in velocities.
+ Return value 9 means filesize seems too off.
+
+ Return value 100+ means test specific error.
+ */
+static int algotest()
+{
+ int i;
+ int *intbox=warnmalloc(NATOMS*3*sizeof *intbox);
+ int *intvelbox=warnmalloc(NATOMS*3*sizeof *intvelbox);
+ double *box1=warnmalloc(NATOMS*STRIDE1*sizeof *box1);
+ double *velbox1=warnmalloc(NATOMS*STRIDE1*sizeof *velbox1);
+ double time1, lambda1;
+ double H1[9];
+ int startframe=0;
+ int endframe=NFRAMES;
+#ifdef GEN
+ FILE *file;
+ double filesize;
+#else
+ int i2;
+ int readreturn;
+ double H2[9];
+ double time2, lambda2;
+ double *box2=warnmalloc(NATOMS*STRIDE2*sizeof *box2);
+ double *velbox2=warnmalloc(NATOMS*STRIDE2*sizeof *velbox2);
+#endif
+#ifdef GEN
+ void *dumpfile=open_tng_file_write(FILENAME,NATOMS,CHUNKY,
+ PRECISION,WRITEVEL,VELPRECISION,
+ INITIALCODING,
+ INITIALCODINGPARAMETER,CODING,CODINGPARAMETER,
+ INITIALVELCODING,INITIALVELCODINGPARAMETER,
+ VELCODING,VELCODINGPARAMETER,SPEED);
+#else
+ void *dumpfile=open_tng_file_read(FILENAME,WRITEVEL);
+#endif
+ if (!dumpfile)
+ return 1;
+ for (i=0; i<9; i++)
+ H1[i]=0.;
+ H1[0]=INTMAX1*PRECISION*SCALE;
+ H1[4]=INTMAX2*PRECISION*SCALE;
+ H1[8]=INTMAX3*PRECISION*SCALE;
+ for (i=startframe; i<endframe; i++)
+ {
+ genibox(intbox,i);
+ realbox(intbox,box1,STRIDE1);
+#if WRITEVEL
+ genivelbox(intvelbox,i);
+ realvelbox(intvelbox,velbox1,STRIDE1);
+#endif
+ time1=(double)i;
+ lambda1=(double)(i+100);
+#ifdef GEN
+ write_tng_file(dumpfile,box1,velbox1);
+#else
+ readreturn=read_tng_file(dumpfile,box2,velbox2);
+ if (readreturn==1) /* general read error */
+ return 1;
+#endif
+#ifndef GEN
+ /* Check for equality of boxes. */
+ if (!equalarr(box1,box2,(double)PRECISION,NATOMS,3,STRIDE1,STRIDE2))
+ return 4;
+#if WRITEVEL
+ if (!equalarr(velbox1,velbox2,(double)VELPRECISION,NATOMS,3,STRIDE1,STRIDE2))
+ return 5;
+#endif
+#endif
+ }
+#ifdef GEN
+ close_tng_file_write(dumpfile);
+#else
+ close_tng_file_read(dumpfile);
+#endif
+#ifdef GEN
+ /* Check against expected filesize for this test. */
+ if (!(file=fopen(FILENAME,"rb")))
+ {
+ fprintf(stderr,"ERROR: Cannot open file "FILENAME"\n");
+ exit(EXIT_FAILURE);
+ }
+ filesize=0;
+ while(1)
+ {
+ char b;
+ if (!fread(&b,1,1,file))
+ break;
+ filesize++;
+ }
+ fclose(file);
+ if (filesize>0)
+ {
+ if ((fabs(filesize-EXPECTED_FILESIZE)/EXPECTED_FILESIZE)>0.05)
+ return 9;
+ }
+#endif
+ return 0;
+}
+
+int main()
+{
+ int testval;
+ if (sizeof(int)<4)
+ {
+ fprintf(stderr,"ERROR: sizeof(int) is too small: %d<4\n",(int)sizeof(int));
+ exit(EXIT_FAILURE);
+ }
+#ifdef GEN
+ printf("Tng compress testsuite generating test: %s\n",TESTNAME);
+#else
+ printf("Tng compress testsuite running test: %s\n",TESTNAME);
+#endif
+ testval=algotest();
+ if (testval==0)
+ printf("Passed.\n");
+ else if (testval==1)
+ {
+ printf("ERROR: File error.\n");
+ exit(EXIT_FAILURE);
+ }
+ else if (testval==4)
+ {
+ printf("ERROR: Read coding error in coordinates.\n");
+ exit(EXIT_FAILURE);
+ }
+ else if (testval==5)
+ {
+ printf("ERROR: Read coding error in velocities.\n");
+ exit(EXIT_FAILURE);
+ }
+ else if (testval==9)
+ {
+ printf("ERROR: Generated filesize differs too much.\n");
+ exit(EXIT_FAILURE);
+ }
+ else
+ {
+ printf("ERROR: Unknown error.\n");
+ exit(EXIT_FAILURE);
+ }
+ return 0;
+}
diff --git a/src/tests/compression/testsuite.sh b/src/tests/compression/testsuite.sh
new file mode 100755
index 0000000..da21de3
--- /dev/null
+++ b/src/tests/compression/testsuite.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+do_write_test="Yes"
+if [ -n "$1" ]; then
+ do_write_test=""
+fi
+STARTTEST=1
+ENDTEST=57
+#CFLAGS="-O2 -Wall"
+CFLAGS="-O2 -g"
+LIBS="-lm"
+#CFLAGS="-O0 -Wall -g"
+#LIBS="-lm -lefence"
+CC="gcc"
+# 32 bit
+#CC="gcc -m32"
+for testnum in $(seq $STARTTEST $ENDTEST); do
+ testname=$(grep "TESTNAME" test$testnum.h|sed 's/#define TESTNAME//')
+ sed "s/TESTPARAM/\"test$testnum.h\"/" <testsuite.c >test$testnum.c
+ if [ -n "$do_write_test" ]; then
+ echo Write test $testnum: $testname
+ $CC -DGEN $CFLAGS -I../ -L../ -o gen$testnum test$testnum.c -ltng_compress $LIBS
+ ./gen$testnum
+ rm -f gen$testnum
+ fi
+ echo Read test $testnum: $testname
+ $CC $CFLAGS -I../ -L../ -o read$testnum test$testnum.c -ltng_compress $LIBS
+ ./read$testnum
+ rm -f read$testnum
+ rm -f test$testnum.c
+done
+
+
+
contact: Jan Huwald // Impressum