diff --git a/CMakeLists.txt b/CMakeLists.txt index 4308c5da..8d5930ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -111,23 +111,33 @@ endif() # git submodule update # ref: https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html -set(MVMC ON) # Option for upstream StdFace. +option(MVMC "build mvmc" ON) # Option for upstream StdFace. +option(TestStdFace "run test for StdFace" OFF) find_package(Git QUIET) -set(STDFACE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/StdFace") -if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") - # Update submodules as needed - if(GIT_SUBMODULE_UPDATE) - message(STATUS "Submodule update") - execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - RESULT_VARIABLE GIT_SUBMOD_RESULT) - if(NOT GIT_SUBMOD_RESULT EQUAL "0") - message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") + +if(NOT STDFACE_DIR) + set(STDFACE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/StdFace") + if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + # Update submodules as needed + if(GIT_SUBMODULE_UPDATE) + message(STATUS "Submodule update") + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMOD_RESULT) + if(NOT GIT_SUBMOD_RESULT EQUAL "0") + message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") + endif() endif() - endif() + if(NOT EXISTS "${STDFACE_DIR}/CMakeLists.txt") + message(FATAL_ERROR "The submodule StdFace were not downloaded! GIT_SUBMODULE_UPDATE was turned off or failed. Please update submodules and try again.") + endif() + endif() +else() if(NOT EXISTS "${STDFACE_DIR}/CMakeLists.txt") - message(FATAL_ERROR "The submodule StdFace were not downloaded! GIT_SUBMODULE_UPDATE was turned off or failed. Please update submodules and try again.") + message(FATAL_ERROR "STDFACE_DIR is manually set to ${STDFACE_DIR}, but ${STDFACE_DIR}/CMakeLists.txt does not exists") + else() + message(STATUS "STDFACE_DIR is manually set to ${STDFACE_DIR}.") endif() endif() add_subdirectory("${STDFACE_DIR}") diff --git a/src/StdFace b/src/StdFace index 92967761..6fa4ef1f 160000 --- a/src/StdFace +++ b/src/StdFace @@ -1 +1 @@ -Subproject commit 92967761b56e6ddf69b1039102dbf0d09256242c +Subproject commit 6fa4ef1f6809001a24b6501bd08f988bdc8cb7c4 diff --git a/src/mVMC/CMakeLists.txt b/src/mVMC/CMakeLists.txt index 44ae92cf..0c72b24d 100644 --- a/src/mVMC/CMakeLists.txt +++ b/src/mVMC/CMakeLists.txt @@ -23,9 +23,9 @@ set(SOURCES_sfmt link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../pfapack) add_executable(vmcdry.out vmcdry.c) -target_link_libraries(vmcdry.out StdFace m) +target_link_libraries(vmcdry.out StdFace_mvmc m) add_executable(vmc.out ${SOURCES_vmcmain} ${SOURCES_sfmt}) -target_link_libraries(vmc.out StdFace) +target_link_libraries(vmc.out StdFace_mvmc m) target_link_libraries(vmc.out pfapack) target_link_libraries(vmc.out ltl2inv) if(PFAFFIAN_BLOCKED) diff --git a/src/mVMC/vmcdry.c b/src/mVMC/vmcdry.c index 9e01c538..b3200426 100644 --- a/src/mVMC/vmcdry.c +++ b/src/mVMC/vmcdry.c @@ -29,7 +29,7 @@ void StdFace_main(char *fname); int main(int argc, char *argv[]) { if (argc == 1){ - printf("Usage: %s StdFace.def\n"); + printf("Usage: %s StdFace.def\n", argv[0]); return 1; } diff --git a/test/python/data/HeisenbergChain_fsz/StdFace.def b/test/python/data/HeisenbergChain_fsz/StdFace.def index 897029a4..ff41d3f1 100644 --- a/test/python/data/HeisenbergChain_fsz/StdFace.def +++ b/test/python/data/HeisenbergChain_fsz/StdFace.def @@ -5,8 +5,8 @@ lattice = "chain" J = 1.0 h = -0.5 Gamma = 0.6 -NSROptItrStep = 1000 -NVMCSample = 500 +NSROptItrStep = 5000 +NVMCSample = 200 DSROptRedCut = 1e-8 DSROptStaDel = 1e-2 DSROptStepDt = 3e-3 diff --git a/test/python/data/HeisenbergChain_fsz_mpi/StdFace.def b/test/python/data/HeisenbergChain_fsz_mpi/StdFace.def index 897029a4..ff41d3f1 100644 --- a/test/python/data/HeisenbergChain_fsz_mpi/StdFace.def +++ b/test/python/data/HeisenbergChain_fsz_mpi/StdFace.def @@ -5,8 +5,8 @@ lattice = "chain" J = 1.0 h = -0.5 Gamma = 0.6 -NSROptItrStep = 1000 -NVMCSample = 500 +NSROptItrStep = 5000 +NVMCSample = 200 DSROptRedCut = 1e-8 DSROptStaDel = 1e-2 DSROptStepDt = 3e-3