diff --git a/CMake/FileLists.cmake b/CMake/FileLists.cmake index 6ddf5798e..bc5e09e49 100644 --- a/CMake/FileLists.cmake +++ b/CMake/FileLists.cmake @@ -14,9 +14,9 @@ set(sources src/CheckpointOutput.cpp src/CheckpointSetup.cpp src/DCDlib.cpp - src/ExtendedSystemOutput.cpp src/EnPartCntSampleOutput.cpp src/ExtendedSystem.cpp + src/ExtendedSystemOutput.cpp src/Ewald.cpp src/EwaldCached.cpp src/FFConst.cpp @@ -87,11 +87,11 @@ set(headers src/CoordinateSetup.h src/CPUSide.h src/DCDlib.h - src/ExtendedSystemOutput.h src/EnergyTypes.h src/EnPartCntSampleOutput.h src/EnsemblePreprocessor.h src/ExtendedSystem.h + src/ExtendedSystemOutput.h src/Ewald.h src/EwaldCached.h src/FFAngles.h diff --git a/src/CheckpointSetup.h b/src/CheckpointSetup.h index e8c889259..bf231550a 100644 --- a/src/CheckpointSetup.h +++ b/src/CheckpointSetup.h @@ -72,6 +72,10 @@ class CheckpointSetup #if GOMC_LIB_MPI void SetParallelTemperingWasEnabled(); void SetPRNGVariablesPT(PRNG & prng); +#endif + +#if GOMC_GTEST + #endif std::string filename; diff --git a/src/ExposeIntrinsicsToGTest.h b/src/ExposeIntrinsicsToGTest.h new file mode 100644 index 000000000..719b8fd0e --- /dev/null +++ b/src/ExposeIntrinsicsToGTest.h @@ -0,0 +1,5 @@ +#if GOMC_GTEST +MoleculeLookup & GetMolLookup(){ + return system->molLookup; +} +#endif \ No newline at end of file diff --git a/src/Simulation.cpp b/src/Simulation.cpp index e95c2d2e6..3c4da6ffd 100644 --- a/src/Simulation.cpp +++ b/src/Simulation.cpp @@ -182,3 +182,9 @@ bool Simulation::RecalculateAndCheck(void) return compare; } + +#if GOMC_GTEST +MoleculeLookup & Simulation::GetMolLookup(){ + return system->molLookup; +} +#endif diff --git a/src/Simulation.h b/src/Simulation.h index e708a7960..27ef3eb2c 100644 --- a/src/Simulation.h +++ b/src/Simulation.h @@ -6,7 +6,6 @@ along with this program, also can be found at . ********************************************************************************/ #ifndef SIMULATION_H #define SIMULATION_H - //Member vars #include "CPUSide.h" #include "System.h" @@ -24,7 +23,9 @@ class Simulation void RunSimulation(void); bool RecalculateAndCheck(void); - + #if GOMC_GTEST + MoleculeLookup & GetMolLookup(); + #endif private: StaticVals * staticValues; System * system; diff --git a/test/FileList.cmake b/test/FileList.cmake index 2f410d692..f6f4d71a1 100644 --- a/test/FileList.cmake +++ b/test/FileList.cmake @@ -6,6 +6,7 @@ set(TestSources test/src/CircuitTester.cpp test/src/PSFParserTest.cpp test/src/ConsistentTrajectoryTest.cpp + test/src/CheckpointTest.cpp ) set(TestHeaders diff --git a/test/GoogleTest.cmake b/test/GoogleTest.cmake index c69f6aa25..a4db52334 100644 --- a/test/GoogleTest.cmake +++ b/test/GoogleTest.cmake @@ -40,6 +40,7 @@ function(add_GCMC_test name) add_test(NAME MolLookupTest_GCMC COMMAND CheckConsensusBeta) #add_test(NAME PSFParserTest_GCMC COMMAND CheckProtAndWaterTest) add_test(NAME ConsistentTrajectoryTest_GCMC COMMAND CheckPDBTrajCoordinates) + add_test(NAME CheckpointTest_GCMC COMMAND CheckMollookup) add_test(NAME EndianTest_GCMC COMMAND TestBitSwap) endfunction(add_GCMC_test) @@ -55,6 +56,7 @@ function(add_GEMC_test name) add_test(NAME MolLookupTest_GEMC COMMAND CheckConsensusBeta) #add_test(NAME PSFParserTest_GEMC COMMAND CheckProtAndWaterTest) add_test(NAME ConsistentTrajectoryTest_GEMC COMMAND CheckPDBTrajCoordinates) + add_test(NAME CheckpointTest_GEMC COMMAND CheckMollookup) add_test(NAME EndianTest_GEMC COMMAND TestBitSwap) endfunction(add_GEMC_test) diff --git a/test/src/CheckpointTest.cpp b/test/src/CheckpointTest.cpp new file mode 100644 index 000000000..9e88b73eb --- /dev/null +++ b/test/src/CheckpointTest.cpp @@ -0,0 +1,39 @@ +#include +#include "PDBSetup.h" +#include "MolSetup.h" +#include "BondAdjacencyList.h" +#include "ConfigSetup.h" +#include "FFSetup.h" //For geometry kinds +#include "FFConst.h" +#include "Reader.h" +#include "InputFileReader.h" +#include "Simulation.h" +#include +/* There are 4 cases for restarting from checkpoint + +1) Base Case: + The first run. + Checkpoint Setup - RestartFromCheckpoint = false + Checkpoint Output - RestartFromCheckpoint = false + +2) The first restart from checkpoint + Checkpoint Setup - RestartFromCheckpoint = true + Checkpoint Output - RestartFromCheckpoint = true + +3) The Nth restart from checkpoint from a prev checkpoint + Checkpoint Setup - RestartFromCheckpoint = true + Checkpoint Output - RestartFromCheckpoint = true + +*/ +TEST(CheckpointTest, CheckAR_KR) { + chdir("./test/input/Checkpoint/AR_KR/Base/"); + Simulation base("in.conf"); + base.RunSimulation(); + chdir("../K_1"); + Simulation K_1("in.conf"); + K_1.RunSimulation(); + chdir("../K_N"); + Simulation K_N("in.conf"); + K_N.RunSimulation(); + chdir("../../../../.."); +} \ No newline at end of file