Skip to content

Commit 9933f8c

Browse files
authored
Fixes and improvements related to random number generation. Improvements for data set filtering. (#887)
* Avoid modulo bias by using bit shifting * Fix Makefile; source changed to cpp * Change function name, results can include max * Override Number_UpTo for Marsaglia since it natively returns between 0 and 1 * Use Number_UpTo() for interval functions * Use rn_num_interval instead of rn_gen * Set RNG to Marsaglia to recover earlier test results. * Try generating numbers between 0 and 1 using method of Doornik * Use the shuffle from Random_Number. Set Marsaglia for Kmeans random test. * Use rn_num_interval for cluster sieve. Set Marsaglia gen for test. * Try to avoid range and modulo bias * Change number of bits reported to dieharder based on RNG. Does not change results. * use rng_gen() times two PI instead of integer values for angle * Try a simpler random algorithm. * Use new simpler algorithm unless back-tracking is specified * Allow other names besides RunTest.sh (more flexible) * Add test for new method, update test for old method * Increase the residue cutoff for the new method. * Add code docs * Only set up CheckResidue() stuff if needed (not needed for new routine). Make max_factor_ a double, and make the default 10. * Get rid of duplicate check * Only need to convert to degrees for debug * Change max factor default back to 2. In new random rotate routine, have max rotations be on a per-dihedral basis. Make rotation counts unsigned in old routine. Fix printf formatting. * Hide some debug info. Fix cleanup * Set default RNG to Marsaglia for tests * Set marsaglia for test * Add some new versions of the randomizeions algorithm, one that does no distance checking, one that only checks for around. * Enable algorithm 3 * Split around select around function * Version that respects around and overlap * Start adding separate DataFilter class * Start adding init * Add support for 'filterset' arg * Start implementing filterindex * Add set to be filtered stuff * Add support for filtering 2d sets * Add support for 3d sets and a check * Enable version 4 * Rename functions to better describe how they work * Move regular index selection into its own function * Make separate placement with no overlap function * use swapIons_NoOverlap() * Add function for only respecting overlap * Move towards using the new algorithms automatically * Add 'originalalgorithm' keyword. * Update help * Add test for new algorithms. * Fix 0 to 1 RNG for stdlib generator * Fix code docs * Add 'gauss' mode to random. * Update manual with gauss keyword for random command. * Add function determining the minimum number of elements among all input data sets. * Save pointer to master dsl * Add Finalize() routine. * Add functions for returning npassed and nfiltered * Add printout * Use DataFilter in FilterByData action * Use DataFilter for exec filter command. Fix infinite loop in DataFilter. * Remove old code * Remove old code. * Clean up keyword help functions * Fix up help * Add count sets and countout keyword * Add 2d matrix filter and count test. * Hide debug info. * Move final printout to individual functions; ensure it only happens when !multi * Fix up filter action and datafilter command entries * Add link to Emmett Leddin's cpptraj vim syntax file * DRR - Go back to Marsaglia for now. New generators still need more testing. * Minor version bump for RNG improvements, data filter improvements, randomizeions improvements, and permutedihedrals improvements. * Fix up and improve randomizeions manual entry. * Fix up help for permutedihedrals * maxfactor option was listed twice * Hail mary to fix github actions... * Try to fix GitHub Actions by putting update and install in the same command instance * Well that was a bust. Try removing the update command...
1 parent e968b9c commit 9933f8c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+45581
-740
lines changed

.github/workflows/merge-gate.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
linux_build:
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-latest
1111
name: Build ${{ matrix.compiler }} with CMake ${{ matrix.use_cmake }}
1212
strategy:
1313
fail-fast: false
@@ -41,7 +41,6 @@ jobs:
4141
steps:
4242
- name: Install prerequisite packages
4343
run: |
44-
sudo apt update
4544
sudo apt-get install gfortran \
4645
libbz2-dev \
4746
libblas-dev \

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ and less than the max # cores on your system) will run much faster.
136136
After installation, It is highly recommended that `make check` be run as
137137
well to test the basic functionality of CPPTRAJ.
138138

139+
There is an independently-maintained VIM syntax file for CPPTRAJ by Emmett Leddin
140+
available [here](https://github.com/emleddin/vim-cpptraj).
141+
139142
CPPTRAJ Authors
140143
===============
141144
**Lead Author:** Daniel R. Roe (<[email protected]>)

devtools/rngtest/Makefile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
include ../../config.h
22

33
#OBJECTS=rngtest.o Random.o RNG.o RNG_Stdlib.o RNG_Marsaglia.o CpptrajStdio.o RNG_MersenneTwister.o RNG_PCG32.o xoshiro128plusplus.o RNG_Xoshiro128pp.o
4-
OBJECTS=xoshiro128plusplus.o
5-
SOURCES=rngtest.cpp ../../src/RNG_MersenneTwister.cpp ../../src/RNG.cpp ../../src/CpptrajStdio.cpp ../../src/Random.cpp ../../src/RNG_Stdlib.cpp ../../src/RNG_Marsaglia.cpp ../../src/RNG_PCG32.cpp ../../src/RNG_Xoshiro128pp.cpp
4+
SOURCES=rngtest.cpp ../../src/RNG_MersenneTwister.cpp ../../src/RNG.cpp ../../src/CpptrajStdio.cpp ../../src/Random.cpp ../../src/RNG_Stdlib.cpp ../../src/RNG_Marsaglia.cpp ../../src/RNG_PCG32.cpp ../../src/RNG_Xoshiro128pp.cpp ../../src/xoshiro128plusplus.cpp
65

76
all: rngtest
87

98
debug:
109
make CXXFLAGS='-O0 -g' CFLAGS='-O0 -g' rngtest
1110

12-
rngtest: $(SOURCES) $(OBJECTS)
13-
$(CXX) $(DIRECTIVES) $(CXXFLAGS) -o rngtest $(SOURCES) $(OBJECTS)
11+
rngtest: $(SOURCES)
12+
$(CXX) $(DIRECTIVES) $(CXXFLAGS) -o rngtest $(SOURCES)
1413

1514
clean:
16-
/bin/rm -f $(OBJECTS) rngtest
15+
/bin/rm -f rngtest
1716

1817
rngtest.o: rngtest.cpp
1918
$(CXX) $(CXXFLAGS) -c -o rngtest.o rngtest.cpp
@@ -42,6 +41,6 @@ CpptrajStdio.o: ../../src/CpptrajStdio.cpp
4241
RNG_Xoshiro128pp.o: ../../src/RNG_Xoshiro128pp.cpp
4342
$(CXX) $(CXXFLAGS) -c -o RNG_Xoshiro128pp.o ../../src/RNG_Xoshiro128pp.cpp
4443

45-
xoshiro128plusplus.o: ../../src/xoshiro128plusplus.c
46-
$(CC) $(CFLAGS) -c -o xoshiro128plusplus.o ../../src/xoshiro128plusplus.c
44+
xoshiro128plusplus.o: ../../src/xoshiro128plusplus.cpp
45+
$(CXX) $(CXXFLAGS) -c -o xoshiro128plusplus.o ../../src/xoshiro128plusplus.cpp
4746

devtools/rngtest/results.0

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Cpptraj type 0
33
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
44
#=============================================================================#
55
rng_name | filename |rands/second|
6-
file_input| temp.0| 5.94e+06 |
6+
file_input| temp.0| 5.97e+06 |
77
#=============================================================================#
88
test_name |ntup| tsamples |psamples| p-value |Assessment
99
#=============================================================================#
@@ -21,7 +21,7 @@ Cpptraj type 0
2121
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
2222
#=============================================================================#
2323
rng_name | filename |rands/second|
24-
file_input| temp.0| 5.81e+06 |
24+
file_input| temp.0| 6.09e+06 |
2525
#=============================================================================#
2626
test_name |ntup| tsamples |psamples| p-value |Assessment
2727
#=============================================================================#
@@ -30,7 +30,7 @@ Cpptraj type 0
3030
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
3131
#=============================================================================#
3232
rng_name | filename |rands/second|
33-
file_input| temp.0| 5.74e+06 |
33+
file_input| temp.0| 6.11e+06 |
3434
#=============================================================================#
3535
test_name |ntup| tsamples |psamples| p-value |Assessment
3636
#=============================================================================#
@@ -39,7 +39,7 @@ Cpptraj type 0
3939
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
4040
#=============================================================================#
4141
rng_name | filename |rands/second|
42-
file_input| temp.0| 5.69e+06 |
42+
file_input| temp.0| 6.06e+06 |
4343
#=============================================================================#
4444
test_name |ntup| tsamples |psamples| p-value |Assessment
4545
#=============================================================================#
@@ -48,7 +48,7 @@ diehard_count_1s_str| 0| 256000| 100|0.00000000| FAILED
4848
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
4949
#=============================================================================#
5050
rng_name | filename |rands/second|
51-
file_input| temp.0| 5.81e+06 |
51+
file_input| temp.0| 6.09e+06 |
5252
#=============================================================================#
5353
test_name |ntup| tsamples |psamples| p-value |Assessment
5454
#=============================================================================#
@@ -75,7 +75,7 @@ diehard_count_1s_byt| 0| 256000| 100|0.00000000| FAILED
7575
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
7676
#=============================================================================#
7777
rng_name | filename |rands/second|
78-
file_input| temp.0| 6.10e+06 |
78+
file_input| temp.0| 6.06e+06 |
7979
#=============================================================================#
8080
test_name |ntup| tsamples |psamples| p-value |Assessment
8181
#=============================================================================#
@@ -84,7 +84,7 @@ diehard_count_1s_byt| 0| 256000| 100|0.00000000| FAILED
8484
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
8585
#=============================================================================#
8686
rng_name | filename |rands/second|
87-
file_input| temp.0| 6.12e+06 |
87+
file_input| temp.0| 6.08e+06 |
8888
#=============================================================================#
8989
test_name |ntup| tsamples |psamples| p-value |Assessment
9090
#=============================================================================#
@@ -93,7 +93,7 @@ diehard_count_1s_byt| 0| 256000| 100|0.00000000| FAILED
9393
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
9494
#=============================================================================#
9595
rng_name | filename |rands/second|
96-
file_input| temp.0| 6.13e+06 |
96+
file_input| temp.0| 6.07e+06 |
9797
#=============================================================================#
9898
test_name |ntup| tsamples |psamples| p-value |Assessment
9999
#=============================================================================#
@@ -103,7 +103,7 @@ diehard_count_1s_byt| 0| 256000| 100|0.00000000| FAILED
103103
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
104104
#=============================================================================#
105105
rng_name | filename |rands/second|
106-
file_input| temp.0| 6.10e+06 |
106+
file_input| temp.0| 6.11e+06 |
107107
#=============================================================================#
108108
test_name |ntup| tsamples |psamples| p-value |Assessment
109109
#=============================================================================#
@@ -113,7 +113,7 @@ diehard_count_1s_byt| 0| 256000| 100|0.00000000| FAILED
113113
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
114114
#=============================================================================#
115115
rng_name | filename |rands/second|
116-
file_input| temp.0| 6.12e+06 |
116+
file_input| temp.0| 6.07e+06 |
117117
#=============================================================================#
118118
test_name |ntup| tsamples |psamples| p-value |Assessment
119119
#=============================================================================#
@@ -123,7 +123,7 @@ diehard_count_1s_byt| 0| 256000| 100|0.00000000| FAILED
123123
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
124124
#=============================================================================#
125125
rng_name | filename |rands/second|
126-
file_input| temp.0| 6.12e+06 |
126+
file_input| temp.0| 6.07e+06 |
127127
#=============================================================================#
128128
test_name |ntup| tsamples |psamples| p-value |Assessment
129129
#=============================================================================#
@@ -132,7 +132,7 @@ diehard_count_1s_byt| 0| 256000| 100|0.00000000| FAILED
132132
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
133133
#=============================================================================#
134134
rng_name | filename |rands/second|
135-
file_input| temp.0| 6.08e+06 |
135+
file_input| temp.0| 6.09e+06 |
136136
#=============================================================================#
137137
test_name |ntup| tsamples |psamples| p-value |Assessment
138138
#=============================================================================#
@@ -141,7 +141,7 @@ diehard_count_1s_byt| 0| 256000| 100|0.00000000| FAILED
141141
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
142142
#=============================================================================#
143143
rng_name | filename |rands/second|
144-
file_input| temp.0| 6.11e+06 |
144+
file_input| temp.0| 6.08e+06 |
145145
#=============================================================================#
146146
test_name |ntup| tsamples |psamples| p-value |Assessment
147147
#=============================================================================#
@@ -179,7 +179,7 @@ diehard_count_1s_byt| 0| 256000| 100|0.00000000| FAILED
179179
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
180180
#=============================================================================#
181181
rng_name | filename |rands/second|
182-
file_input| temp.0| 6.10e+06 |
182+
file_input| temp.0| 6.06e+06 |
183183
#=============================================================================#
184184
test_name |ntup| tsamples |psamples| p-value |Assessment
185185
#=============================================================================#
@@ -188,7 +188,7 @@ rgb_minimum_distance| 0| 10000| 1000|0.00000000| FAILED
188188
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
189189
#=============================================================================#
190190
rng_name | filename |rands/second|
191-
file_input| temp.0| 4.17e+06 |
191+
file_input| temp.0| 6.08e+06 |
192192
#=============================================================================#
193193
test_name |ntup| tsamples |psamples| p-value |Assessment
194194
#=============================================================================#
@@ -197,7 +197,7 @@ rgb_minimum_distance| 0| 10000| 1000|0.00000000| FAILED
197197
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
198198
#=============================================================================#
199199
rng_name | filename |rands/second|
200-
file_input| temp.0| 5.78e+06 |
200+
file_input| temp.0| 6.10e+06 |
201201
#=============================================================================#
202202
test_name |ntup| tsamples |psamples| p-value |Assessment
203203
#=============================================================================#
@@ -206,7 +206,7 @@ rgb_minimum_distance| 0| 10000| 1000|0.00000000| FAILED
206206
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
207207
#=============================================================================#
208208
rng_name | filename |rands/second|
209-
file_input| temp.0| 5.75e+06 |
209+
file_input| temp.0| 6.08e+06 |
210210
#=============================================================================#
211211
test_name |ntup| tsamples |psamples| p-value |Assessment
212212
#=============================================================================#
@@ -215,7 +215,7 @@ rgb_minimum_distance| 0| 10000| 1000|0.00000000| FAILED
215215
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
216216
#=============================================================================#
217217
rng_name | filename |rands/second|
218-
file_input| temp.0| 5.67e+06 |
218+
file_input| temp.0| 6.07e+06 |
219219
#=============================================================================#
220220
test_name |ntup| tsamples |psamples| p-value |Assessment
221221
#=============================================================================#
@@ -224,7 +224,7 @@ rgb_minimum_distance| 0| 10000| 1000|0.00000000| FAILED
224224
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
225225
#=============================================================================#
226226
rng_name | filename |rands/second|
227-
file_input| temp.0| 5.74e+06 |
227+
file_input| temp.0| 6.07e+06 |
228228
#=============================================================================#
229229
test_name |ntup| tsamples |psamples| p-value |Assessment
230230
#=============================================================================#
@@ -233,7 +233,7 @@ rgb_minimum_distance| 0| 10000| 1000|0.00000000| FAILED
233233
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
234234
#=============================================================================#
235235
rng_name | filename |rands/second|
236-
file_input| temp.0| 5.78e+06 |
236+
file_input| temp.0| 6.09e+06 |
237237
#=============================================================================#
238238
test_name |ntup| tsamples |psamples| p-value |Assessment
239239
#=============================================================================#
@@ -243,7 +243,7 @@ rgb_minimum_distance| 0| 10000| 1000|0.00000000| FAILED
243243
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
244244
#=============================================================================#
245245
rng_name | filename |rands/second|
246-
file_input| temp.0| 5.75e+06 |
246+
file_input| temp.0| 6.11e+06 |
247247
#=============================================================================#
248248
test_name |ntup| tsamples |psamples| p-value |Assessment
249249
#=============================================================================#
@@ -253,7 +253,7 @@ rgb_minimum_distance| 0| 10000| 1000|0.00000000| FAILED
253253
# dieharder version 3.31.1 Copyright 2003 Robert G. Brown #
254254
#=============================================================================#
255255
rng_name | filename |rands/second|
256-
file_input| temp.0| 5.31e+06 |
256+
file_input| temp.0| 6.10e+06 |
257257
#=============================================================================#
258258
test_name |ntup| tsamples |psamples| p-value |Assessment
259259
#=============================================================================#

0 commit comments

Comments
 (0)