QMCPACK
test_HybridEngine.cpp
Go to the documentation of this file.
1 //////////////////////////////////////////////////////////////////////////////////////
2 // This file is distributed under the University of Illinois/NCSA Open Source License.
3 // See LICENSE file in top directory for details.
4 //
5 // Copyright (c) 2019 QMCPACK developers.
6 //
7 // File developed by: Leon Otis, leon_otis@berkeley.edu University, University of California Berkeley
8 // Ye Luo, yeluo@anl.gov, Argonne National Laboratory
9 //
10 // File created by: Leon Otis, leon_otis@berkeley.edu University, University of California Berkeley
11 //////////////////////////////////////////////////////////////////////////////////////
12 
13 #include "catch.hpp"
14 
17 
18 namespace qmcplusplus
19 {
20 
21 /// This provides a basic test of the hybrid engine's check on whether vectors need to be stored
22 TEST_CASE("Hybrid Engine query store","[drivers][hybrid]")
23 {
24 
25  //A fake constructor is used that sets the hybrid engine's step_num_ variable to 0 instead of the usual -1
26  std::unique_ptr<HybridEngine> hybridEngineObj = std::make_unique<HybridEngine>();
27 
28  //Descent and adaptive methods with associated numbers of update steps are added to the engine
29  hybridEngineObj->addMethod(OptimizerType::DESCENT);
30  hybridEngineObj->addUpdates(100);
31 
32  hybridEngineObj->addMethod(OptimizerType::ADAPTIVE);
33  hybridEngineObj->addUpdates(3);
34 
35  //A typical number of vectors that might be requested over the course of a descent optimization in the hybrid method
36  int test_store_num = 5;
37 
38  //Engine checks whether a vector should be stored. With step_num_ set to 0 this should be false.
39  int result = hybridEngineObj->queryStore(test_store_num,OptimizerType::DESCENT);
40 
41  app_log() << "Hybrid Test Result: " << result << std::endl;
42 
43  REQUIRE(result == false);
44 
45 
46 }
47 
48 
49 }
50 
helper functions for EinsplineSetBuilder
Definition: Configuration.h:43
std::ostream & app_log()
Definition: OutputManager.h:65
TEST_CASE("complex_helper", "[type_traits]")
REQUIRE(std::filesystem::exists(filename))