Skip to content

Test VMC

Run the test suite after building on a new compiler or system and after changing the simulation, wavefunction, energy, optimizer, or output code.

From the repository root:

Terminal window
./scripts/test.sh

The script creates build-tests, configures a Debug FP64 CPU build, builds vmc_tests, and runs CTest with --output-on-failure. It always configures VMC_ENABLE_CUDA=OFF; this script does not test the CUDA backend.

On a clean build, CMake fetches Catch2 3.8.1 from GitHub, so the first configuration needs network access. The final portion of a successful run was:

85/94 Test #85: Finite-size convergence: N=7 and N=19 agree at r_s=5 ............................................. Passed 3.27 sec
Start 86: Blocking analysis produces finite standard error
86/94 Test #86: Blocking analysis produces finite standard error ................................................. Passed 1.31 sec
Start 87: Warmup produces reasonable acceptance rate
87/94 Test #87: Warmup produces reasonable acceptance rate ....................................................... Passed 0.95 sec
Start 88: Energy per particle at r_s=1 is positive and bounded
88/94 Test #88: Energy per particle at r_s=1 is positive and bounded ............................................. Passed 1.72 sec
Start 89: Standard error is small relative to energy scale
89/94 Test #89: Standard error is small relative to energy scale ................................................. Passed 1.75 sec
Start 90: Same seed produces identical energy
90/94 Test #90: Same seed produces identical energy .............................................................. Passed 0.73 sec
Start 91: Independent seeds produce consistent energies
91/94 Test #91: Independent seeds produce consistent energies .................................................... Passed 2.89 sec
Start 92: WaveFunction evaluateDerivatives clears buffers and delegates to Jastrow
92/94 Test #92: WaveFunction evaluateDerivatives clears buffers and delegates to Jastrow ......................... Passed 0.01 sec
Start 93: WaveFunction evaluate_log_psi returns finite for N=1
93/94 Test #93: WaveFunction evaluate_log_psi returns finite for N=1 .............................................. Passed 0.01 sec
Start 94: WaveFunction default Jastrow parameter matches fully polarized cusp choice
94/94 Test #94: WaveFunction default Jastrow parameter matches fully polarized cusp choice ....................... Passed 0.01 sec
100% tests passed, 0 tests failed out of 94
Total Test time (real) = 52.82 sec

CTest discovers individual Catch2 test cases. The test executable also accepts Catch2 tag filters. For example:

Terminal window
./build-tests/vmc_tests '[config]'
./build-tests/vmc_tests '[energy]'
./build-tests/vmc_tests '[validation]'

To list the available tags:

Terminal window
./build-tests/vmc_tests --list-tags

Observed output:

All available tags:
3 [aligned_soa]
3 [blocking]
11 [config]
6 [energy]
10 [interacting]
6 [jastrow]
3 [matrix]
3 [optimizer]
2 [output_writer]
2 [particles]
8 [published]
9 [rigorous]
7 [simulation]
19 [slater]
7 [validation]
4 [wavefunction]
16 tags

The test script accepts the same precision-related flags as the build script:

Terminal window
./scripts/test.sh --fp32
./scripts/test.sh --vmc-fast-math

You may also provide a build type as a positional argument, such as ./scripts/test.sh Release.

The test workflow is defined by scripts/test.sh and the testing section of CMakeLists.txt. Test cases are under tests/.