Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
dbf4f4e
Add ABC for random number generators.
drroe Feb 19, 2021
310c85c
Make rn_set a base class function that can call clock() if needed; th…
drroe Feb 19, 2021
8408e6e
Add Marsaglia RNG
drroe Feb 19, 2021
a965e93
Change to Generate()
drroe Feb 19, 2021
5012da5
Change to Set_Seed()
drroe Feb 19, 2021
6061980
Change to GenerateGauss
drroe Feb 19, 2021
3963497
Make Random_Number an interface
drroe Feb 19, 2021
228872b
Enable interface for RNG
drroe Feb 19, 2021
973c736
Start adding stdlib rng
drroe Feb 19, 2021
8f7fed3
Allocate based on what the current default RNG is
drroe Feb 19, 2021
9b87972
Remove unused default rng seed set
drroe Feb 20, 2021
54b424a
Fix variable names
drroe Feb 20, 2021
50296da
Random routines can be const
drroe Feb 20, 2021
655c083
Start adding a RNG test
drroe Feb 20, 2021
5f136d3
Add random number stream generation compatible with dieharder
drroe Feb 20, 2021
a313e45
Add test script
drroe Feb 20, 2021
59f67ef
Add missing object rule
drroe Feb 20, 2021
acb3ab9
Merge branch 'rng' of github.com:drroe/cpptraj into rng
drroe Feb 20, 2021
4978deb
Increase size of the stream. Remove final extra newline.
drroe Feb 21, 2021
ee5c832
Start adding Mersenne twister
drroe Feb 21, 2021
3b73467
Capture set seed errors
drroe Feb 21, 2021
62621f3
Enable Mersenne twister
drroe Feb 21, 2021
61c2e4a
Increase the number of values tested. Add missing depend
drroe Feb 21, 2021
ae18971
Redirect results to files for easier comparison
drroe Feb 21, 2021
e5f4421
Add a mode to just generate a random integer directly
drroe Feb 21, 2021
a933aab
Add PCG from Melissa O'Neill
drroe Feb 21, 2021
1d23f36
Enable PCG32
drroe Feb 21, 2021
967e614
Test the pcg32 implementation
drroe Feb 21, 2021
fa8726c
First attempt adding xoshiro 128++ rng
drroe Feb 21, 2021
3a85d58
Add Xoshiro 128++ RNG class
drroe Feb 21, 2021
854dbb9
Test new generator
drroe Feb 21, 2021
c77623b
Move Gaussian PRNG to Random
drroe Feb 22, 2021
c11855a
Improve code docs
drroe Feb 22, 2021
09be000
Add function to generate random number on an interval
drroe Feb 22, 2021
c07fc4b
Add signed/unsigned versions of interval function
drroe Feb 22, 2021
f510756
Add Fisher Yates shuffle to random
drroe Feb 22, 2021
c2173c4
Add test for shuffle
drroe Feb 22, 2021
50adf87
Add description. Add debug mode compile
drroe Feb 22, 2021
d410adc
Move constructor to cpp source
drroe Feb 22, 2021
e6c3994
Check for seed error
drroe Feb 22, 2021
8e40d37
Change the way linking is done. Not sure why the other way was giving…
drroe Feb 22, 2021
8d27531
Print RNG string
drroe Feb 22, 2021
80cfdf9
Start adding new random command
drroe Feb 22, 2021
0d21fd0
Start adding ability to create data sets
drroe Feb 22, 2021
1cdcdea
Add C11_SUPPORT to defines
drroe Feb 22, 2021
b0b9f01
Start adding rng test
drroe Feb 22, 2021
dcbc724
Test mersenne twister with c++11 support
drroe Feb 22, 2021
8ac226b
Add help
drroe Feb 22, 2021
0e9612c
Do not list mt as a rng option if no c11 support
drroe Feb 22, 2021
e43213d
Add missing bracket to help text
drroe Feb 22, 2021
efe94b4
Add unsigned integer DataSet type
drroe Feb 22, 2021
a0747d3
Have random use unsigned int set
drroe Feb 22, 2021
c644183
Add test saves
drroe Feb 22, 2021
ad1688f
Add missing comma
drroe Feb 22, 2021
c5ef288
Add float01 mode
drroe Feb 22, 2021
0d8729d
Move RNG change to CpptrajState
drroe Feb 22, 2021
19f1f17
Add --rng command line arg
drroe Feb 22, 2021
795c23e
Add links for PCG32 and Xoshiro RNGs
drroe Feb 22, 2021
d6d43ca
Add range tests
drroe Feb 24, 2021
2b3a54b
The Marsaglia generate max is 24 bits, adjust Number() accordingly
drroe Feb 24, 2021
e5f45aa
Allow max to be changed. Calculate average and absolute average
drroe Feb 24, 2021
9bed6f5
Update Marsaglia results for fixed max value
drroe Feb 24, 2021
c29afd6
Add help text
drroe Feb 24, 2021
9c74129
Add entry for random command
drroe Feb 24, 2021
86d37ba
Set default RNG back to Marsaglia so tests pass.
drroe Feb 24, 2021
3b0c462
Enable random tests. Ensure CPPTRAJ_RNG is exported
drroe Feb 24, 2021
83d47bd
Add file which will contain functions that only pytraj needs.
drroe Feb 25, 2021
c12e1fc
Rename, make more general
drroe Feb 25, 2021
5d33202
Change to ExternalFxn
drroe Feb 25, 2021
c7fdc09
Convert to c++ file; has c++-like syntax anyway.
Feb 25, 2021
4526c0b
Merge remote-tracking branch 'origin/rng' into rng
drroe Feb 25, 2021
1b3fe6e
Add URL and note about interface people know I am to blame for that
drroe Feb 25, 2021
85aa639
Go back to Marsaglia as default RNG until more testing can be done.
drroe Feb 25, 2021
9608eb9
Replace defunct Travis status with GitHub actions status
drroe Feb 25, 2021
b342d44
Comment out defaultSeed for now, not used. Change MARSAGLIAS to MARSA…
drroe Feb 25, 2021
e74ca5e
Remove leading bracket
drroe Feb 25, 2021
0a65a5e
Add actions URL
drroe Feb 25, 2021
94cd2ba
Start adding TestU01 tests
drroe Feb 25, 2021
e7fd46e
Add link options and clean target
drroe Feb 25, 2021
95dbf90
Do correct C/C++ mixing
drroe Feb 25, 2021
2fe3e65
Use main config.h file
drroe Feb 25, 2021
99b9a21
Use env var
drroe Feb 25, 2021
eb99bf5
Add volmap volume test
drroe Feb 26, 2021
e0434f6
Add ability to run regular crush tests
drroe Feb 26, 2021
11f9146
Add TestU01 results
drroe Feb 26, 2021
2cf09fa
Add citations for RNG to manual
drroe Feb 26, 2021
eebf178
Dont hide evalplateau; published now.
drroe Feb 26, 2021
bfcebf6
Add evalplateau command to manual. Add citations for volmap speedup a…
drroe Feb 26, 2021
154c203
Revision bump for added RNGs, rng command, making evalplateau not hid…
drroe Feb 26, 2021
30d5f83
Fix formatting
drroe Feb 26, 2021
8284ea2
Add dieharder results.
drroe Feb 26, 2021
28a8f14
Do not test volume yet, not ready for prime time.
drroe Feb 26, 2021
bb054d8
Split out stdlib rand test and do not run on windows, which seems to …
drroe Feb 26, 2021
e13a15d
Try to fix visual studio compilation by adding some defines.
drroe Feb 26, 2021
8dd0f68
Split off pcg32 test; does not compile for windows
drroe Feb 26, 2021
ff4a3d3
PCG32 does not currently compile under visual studio
drroe Feb 26, 2021
3dbdb74
Try to fix the tzdata issue with libcpptraj
drroe Feb 26, 2021
29d5ba8
Second try to fix tzdata
drroe Feb 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Fast, parallelized molecular dynamics trajectory data analysis.

Build Status
=============
* Travis-CI: [![Travis Build Status](https://travis-ci.org/Amber-MD/cpptraj.svg?branch=master)](https://travis-ci.org/Amber-MD/cpptraj)
* GitHub Actions: [![GitHub Actions Status](https://github.com/Amber-MD/cpptraj/actions/workflows/merge-gate.yml/badge.svg)](https://github.com/Amber-MD/cpptraj/actions)
* AppVeyor: [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/Amber-MD/cpptraj?branch=master&svg=true&retina=true)](https://ci.appveyor.com/project/drroe/cpptraj-aof9y/branch/master)
* Jenkins: [![Jenkins Build Status](https://jenkins.jasonswails.com/buildStatus/icon?job=amber-github%2Fcpptraj%2Fmaster&style=plastic)](https://jenkins.jasonswails.com/job/amber-github/job/cpptraj/job/master/)
* LGTM: [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/Amber-MD/cpptraj.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Amber-MD/cpptraj/context:cpp)
Expand Down Expand Up @@ -84,10 +84,12 @@ the following libraries:

CPPTRAJ also makes use of the following libraries that are bundled with CPPTRAJ. External ones can be used in place of these if desired.

* ARPACK; without this diagonalization of sparse matrices in `diagmatrix` will be slow
* [helPME](https://github.com/andysim/helpme), required for PME functionality
* XDR for reading GROMACS XTC trajectories
* TNG for reading GROMACS TNG trajectories
* ARPACK; without this diagonalization of sparse matrices in `diagmatrix` will be slow.
* [helPME](https://github.com/andysim/helpme) by Andy Simmonett, required for PME functionality.
* XDR for reading GROMACS XTC trajectories.
* TNG for reading GROMACS TNG trajectories.

CPPTRAJ also uses the PCG32 and Xoshiro 128++ pseudo-random number generators.

`./configure gnu` should be adequate to set up compilation for most systems.
For systems without BLAS/LAPACK/ARPACK and/or NetCDF libraries installed,
Expand Down Expand Up @@ -213,8 +215,8 @@ Original implementation of the Amber NetCDF trajectory format.
* Hannes H. Loeffler (STFC Daresbury, Scientific Computing Department, Warrington, WA4 4AD, UK)
Diffusion calculation code adapted for use in Action\_STFC\_Diffusion.

External libraries bundled with CPPTRAJ
=======================================
External code/libraries bundled with CPPTRAJ
============================================

* CPPTRAJ makes use of the [GNU readline](https://tiswww.case.edu/php/chet/readline/rltop.html) library for the interactive command line.

Expand All @@ -227,3 +229,5 @@ External libraries bundled with CPPTRAJ
* The reciprocal part of the PME calculation is handled by the [helPME](https://github.com/andysim/helpme) library by Andy Simmonett.

* Support for reading DTR trajectories uses the VMD DTR plugin.

* CPPTRAJ uses code for the [permuted congruent pseudo-random number generator](https://www.pcg-random.org/index.html) PCG32 by Melissa O'Neill and the [Xoshiro 128++ pseudo-random number generator](http://prng.di.unimi.it) by David Blackman and Sebastino Vigna.
3 changes: 2 additions & 1 deletion devtools/ci/jenkins/Dockerfile.libcpptraj
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM condaforge/miniforge3

# noninteractive to try and fix tzdata issue
RUN mkdir /cpptraj && \
mkdir /.conda /.local && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y gfortran gcc g++ bzip2 libfftw3-dev automake make libbz2-dev \
DEBIAN_FRONTEND="noninteractive" apt-get install -y gfortran gcc g++ bzip2 libfftw3-dev automake make libbz2-dev \
mpich libmpich-dev zlib1g-dev netcdf-bin libnetcdf-dev \
liblapack-dev libarpack2-dev

Expand Down
47 changes: 47 additions & 0 deletions devtools/rngtest/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
include ../../config.h

#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
OBJECTS=xoshiro128plusplus.o
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

all: rngtest

debug:
make CXXFLAGS='-O0 -g' CFLAGS='-O0 -g' rngtest

rngtest: $(SOURCES) $(OBJECTS)
$(CXX) $(DIRECTIVES) $(CXXFLAGS) -o rngtest $(SOURCES) $(OBJECTS)

clean:
/bin/rm -f $(OBJECTS) rngtest

rngtest.o: rngtest.cpp
$(CXX) $(CXXFLAGS) -c -o rngtest.o rngtest.cpp

Random.o: ../../src/Random.cpp
$(CXX) $(CXXFLAGS) -c -o Random.o ../../src/Random.cpp

RNG.o: ../../src/RNG.cpp
$(CXX) $(CXXFLAGS) -c -o RNG.o ../../src/RNG.cpp

RNG_Stdlib.o: ../../src/RNG_Stdlib.cpp
$(CXX) $(CXXFLAGS) -c -o RNG_Stdlib.o ../../src/RNG_Stdlib.cpp

RNG_Marsaglia.o: ../../src/RNG_Marsaglia.cpp
$(CXX) $(CXXFLAGS) -c -o RNG_Marsaglia.o ../../src/RNG_Marsaglia.cpp

RNG_MersenneTwister.o: ../../src/RNG_MersenneTwister.cpp
$(CXX) $(DIRECTIVES) $(CXXFLAGS) -c -o RNG_MersenneTwister.o ../../src/RNG_MersenneTwister.cpp

RNG_PCG32.o: ../../src/RNG_PCG32.cpp
$(CXX) $(CXXFLAGS) -c -o RNG_PCG32.o ../../src/RNG_PCG32.cpp

CpptrajStdio.o: ../../src/CpptrajStdio.cpp
$(CXX) $(CXXFLAGS) -c -o CpptrajStdio.o ../../src/CpptrajStdio.cpp

RNG_Xoshiro128pp.o: ../../src/RNG_Xoshiro128pp.cpp
$(CXX) $(CXXFLAGS) -c -o RNG_Xoshiro128pp.o ../../src/RNG_Xoshiro128pp.cpp

xoshiro128plusplus.o: ../../src/xoshiro128plusplus.c
$(CC) $(CFLAGS) -c -o xoshiro128plusplus.o ../../src/xoshiro128plusplus.c

41 changes: 41 additions & 0 deletions devtools/rngtest/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Dieharder Results
=================

The results from the Dieharder test suite for the various RNGs in cpptraj are in the results.X files. The following tests were run:
```
Test Number Test Name Test Reliability
===============================================================================
-d 0 Diehard Birthdays Test Good
-d 1 Diehard OPERM5 Test Good
-d 2 Diehard 32x32 Binary Rank Test Good
-d 3 Diehard 6x8 Binary Rank Test Good
-d 4 Diehard Bitstream Test Good
-d 8 Diehard Count the 1s (stream) Test Good
-d 9 Diehard Count the 1s Test (byte) Good
-d 10 Diehard Parking Lot Test Good
-d 11 Diehard Minimum Distance (2d Circle) Test Good
-d 12 Diehard 3d Sphere (Minimum Distance) Test Good
-d 13 Diehard Squeeze Test Good
-d 15 Diehard Runs Test Good
-d 16 Diehard Craps Test Good
-d 17 Marsaglia and Tsang GCD Test Good
-d 100 STS Monobit Test Good
-d 101 STS Runs Test Good
-d 102 STS Serial Test (Generalized) Good
-d 201 RGB Generalized Minimum Distance Test Good
-d 202 RGB Permutations Test Good
-d 203 RGB Lagged Sum Test Good
-d 204 RGB Kolmogorov-Smirnov Test Test Good
-d 205 Byte Distribution Good
-d 206 DAB DCT Good
-d 207 DAB Fill Tree Test Good
-d 208 DAB Fill Tree 2 Test Good
-d 209 DAB Monobit 2 Test Good
```

- 0: Marsaglia: 44 failed
- 1: C stdlib: 37 failed
- 2: Mersenne Twister (mt19937 from C++ std): 2 failed.
- 3: Permuted congruential generator 32: 2 failed.
- 4: Xoshiro128++: 2 failed.

50 changes: 50 additions & 0 deletions devtools/rngtest/RunTest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

COUNT=100000000

make rngtest

# NOTE: Omitting test 200 for now. Gives following message:
#Error: Can only test distribution of positive ntuples.
# Use -n ntuple for 0 < ntuple.
# Read test description with dieharder -d 200 -h.

TESTNUMS='0 1 2 3 4 8 9 10 11 12 13 15 16 17 100 101 102 201 202 203 204 205 206 207 208 209'

TYPELIST=''
DIEHARD='no'
while [ ! -z "$1" ] ; do
case "$1" in
'-type' ) shift; TYPELIST="$TYPELIST $1" ;;
esac
shift
done
if [ -z "$TYPELIST" ] ; then
TYPELIST='0 1 2 3 4'
DIEHARD='yes'
fi
echo "Type list: $TYPELIST"

for CPPTRAJTYPE in $TYPELIST ; do
OUTFILE=results.$CPPTRAJTYPE
echo "Cpptraj type $CPPTRAJTYPE"
echo "Cpptraj type $CPPTRAJTYPE" > $OUTFILE
TMPFILE=temp.$CPPTRAJTYPE
./rngtest -t $COUNT -S 1 -r $CPPTRAJTYPE > $TMPFILE
for TEST in $TESTNUMS ; do
echo "Test $TEST"
dieharder -d $TEST -f $TMPFILE -g 202 >> $OUTFILE
done
echo ""
done

if [ "$DIEHARD" = 'yes' ] ; then
echo "Diehard numbers"
echo "Diehard numbers" > results.diehard
dieharder -S 1 -B -o -t $COUNT > diehard.numbers
for TEST in $TESTNUMS ; do
echo "Test $TEST"
dieharder -d $TEST -f diehard.numbers -g 202 >> results.diehard
done
echo ""
fi
Loading