Skip to content

Commit d13c835

Browse files
committed
cleaned up cmake wrt minimal pools
1 parent e67bcd5 commit d13c835

File tree

12 files changed

+233
-183
lines changed

12 files changed

+233
-183
lines changed

src/Estimators/tests/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ else()
2525
add_library(test_estimators_help ${TEST_ESTIMATORS_HELP})
2626
endif()
2727

28-
target_link_libraries(test_estimators_help catch_main qmcestimators minimal_testing_pools mock_walker_elements)
28+
target_link_libraries(test_estimators_help catch_main qmcestimators mock_walker_elements)
2929

3030
set(UTEST_EXE test_${SRC_DIR})
3131
set(UTEST_NAME deterministic-unit_test_${SRC_DIR})
@@ -73,7 +73,7 @@ set(SRCS
7373
)
7474

7575
add_executable(${UTEST_EXE} ${SRCS})
76-
target_link_libraries(${UTEST_EXE} catch_main qmcutil qmcestimators test_estimators_help utilities_for_test sposets_for_testing minimal_testing_pools minimal_particle_pool)
76+
target_link_libraries(${UTEST_EXE} catch_main qmcutil qmcestimators test_estimators_help utilities_for_test sposets_for_testing minimal_test_pools)
7777
if(USE_OBJECT_TARGET)
7878
target_link_libraries(
7979
${UTEST_EXE}
@@ -118,7 +118,7 @@ if(HAVE_MPI)
118118
utilities_for_test)
119119
endif()
120120
target_link_libraries(${UTEST_EXE} catch_main qmcestimators
121-
test_estimators_help minimal_testing_pools mock_walker_elements)
121+
test_estimators_help minimal_test_pools mock_walker_elements)
122122
# Right now the unified driver mpi tests are hard coded for 3 MPI ranks
123123
add_unit_test(${UTEST_NAME} 3 1 $<TARGET_FILE:${UTEST_EXE}>)
124124
endif()

src/Particle/LongRange/tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ set(UTEST_EXE test_${SRC_DIR})
1414
set(UTEST_NAME deterministic-unit_test_${SRC_DIR})
1515

1616
add_executable(${UTEST_EXE} test_lrhandler.cpp test_ewald3d.cpp test_temp.cpp test_srcoul.cpp test_StructFact.cpp test_kcontainer.cpp)
17-
target_link_libraries(${UTEST_EXE} catch_main qmcparticle minimal_testing_pools)
17+
target_link_libraries(${UTEST_EXE} catch_main qmcparticle minimal_particle_pool)
1818
if(USE_OBJECT_TARGET)
1919
target_link_libraries(${UTEST_EXE} qmcutil qmcparticle_omptarget)
2020
endif()

src/QMCDrivers/tests/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if(HAVE_MPI)
4343
endif()
4444
add_executable(${UTEST_EXE} ${DRIVER_TEST_SRC})
4545

46-
target_link_libraries(${UTEST_EXE} catch_main qmcdriver minimal_testing_pools minimal_particle_pool)
46+
target_link_libraries(${UTEST_EXE} catch_main qmcdriver minimal_test_pools)
4747
if(USE_OBJECT_TARGET)
4848
target_link_libraries(
4949
${UTEST_EXE}
@@ -87,7 +87,7 @@ set(DRIVER_TEST_SRC
8787
test_Eigensolver.cpp
8888
test_WFOptDriverInput.cpp)
8989
add_executable(${UTEST_EXE} ${DRIVER_TEST_SRC})
90-
target_link_libraries(${UTEST_EXE} catch_main qmcdriver minimal_testing_pools minimal_particle_pool)
90+
target_link_libraries(${UTEST_EXE} catch_main qmcdriver minimal_test_pools)
9191
if(USE_OBJECT_TARGET)
9292
target_link_libraries(
9393
${UTEST_EXE}
@@ -111,7 +111,7 @@ if(HAVE_MPI)
111111
#this is dependent on the directory creation and sym linking of earlier driver tests
112112
set(DRIVER_TEST_SRC SetupPools.cpp test_WalkerControl.cpp test_QMCDriverNew.cpp)
113113
add_executable(${UTEST_EXE} ${DRIVER_TEST_SRC})
114-
target_link_libraries(${UTEST_EXE} catch_main qmcdriver minimal_testing_pools minimal_particle_pool)
114+
target_link_libraries(${UTEST_EXE} catch_main qmcdriver minimal_test_pools)
115115
if(USE_OBJECT_TARGET)
116116
target_link_libraries(
117117
${UTEST_EXE}

src/QMCHamiltonians/tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ foreach(CATEGORY coulomb force ham ewald2d)
6868
string(TOUPPER "${CATEGORY}_SRCS" SOURCE_FILE_VAR_NAME)
6969
add_executable(${UTEST_EXE} ${${SOURCE_FILE_VAR_NAME}})
7070

71-
target_link_libraries(${UTEST_EXE} catch_main qmcham utilities_for_test minimal_testing_pools minimal_particle_pool)
71+
target_link_libraries(${UTEST_EXE} catch_main qmcham utilities_for_test minimal_test_pools)
7272
if(USE_OBJECT_TARGET)
7373
target_link_libraries(${UTEST_EXE} qmcwfs qmcwfs_omptarget qmcparticle qmcparticle_omptarget spline2 spline2_omptarget qmcutil platform_omptarget_LA)
7474
endif()

src/QMCWaveFunctions/tests/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ foreach(CATEGORY common trialwf sposet jastrow determinant)
186186
sposets_for_testing
187187
utilities_for_test
188188
container_testing
189-
minimal_testing_pools
190-
minimal_particle_pool)
189+
minimal_particle_pool
190+
minimal_wavefunction_pool)
191191
if(USE_OBJECT_TARGET)
192192
target_link_libraries(${UTEST_EXE} qmcparticle qmcparticle_omptarget qmcwfs_omptarget spline2 spline2_omptarget qmcutil platform_omptarget_LA)
193193
endif()

src/integration_testing/CMakeLists.txt

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@
77
#// File developed by: Peter Doak, [email protected], Oak Ridge National Laboratory
88
#//////////////////////////////////////////////////////////////////////////////////////
99

10+
# a targets for the individual minimal testing pools.
11+
#
12+
# They may be used to minimize dependency in tests when possible.
13+
#
14+
15+
add_library(minimal_particle_pool MinimalParticlePool.cpp)
16+
target_include_directories(minimal_particle_pool PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
17+
target_link_libraries(minimal_particle_pool PUBLIC qmcparticle)
18+
19+
add_library(minimal_wavefunction_pool MinimalWaveFunctionPool.cpp)
20+
target_include_directories(minimal_wavefunction_pool PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
21+
target_link_libraries(minimal_wavefunction_pool PUBLIC qmcwfs)
22+
23+
add_library(minimal_hamiltonian_pool MinimalHamiltonianPool.cpp)
24+
target_include_directories(minimal_hamiltonian_pool PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
25+
target_link_libraries(minimal_hamiltonian_pool PUBLIC qmcham)
26+
27+
# use this target if using all three minimal pools
28+
add_library(minimal_test_pools INTERFACE)
29+
target_link_libraries(minimal_test_pools INTERFACE minimal_particle_pool minimal_wavefunction_pool minimal_hamiltonian_pool)
30+
1031
# at the crowd thread scope of the API's each walker is associated
1132
# with one object of ParticleSet, QMCWavefunction, and
1233
# QMCHamiltonian i.e. walker elements
@@ -19,31 +40,5 @@
1940
# elements needed for many integration tests in the future
2041
add_library(mock_walker_elements MockGoldWalkerElements.cpp)
2142
target_include_directories(mock_walker_elements PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
22-
target_link_libraries(mock_walker_elements PUBLIC minimal_testing_pools qmcparticle qmcwfs qmcham message minimal_particle_pool)
43+
target_link_libraries(mock_walker_elements PUBLIC qmcparticle qmcwfs qmcham minimal_test_pools message)
2344
target_link_libraries(mock_walker_elements PRIVATE catch_main)
24-
25-
# a target for the minimal testing pools.
26-
# This should be used by test programs using any of the minimal
27-
# pools
28-
#
29-
# What it does:
30-
# It removes the need to include a relative
31-
# path into another modules testing directory to use a minimal pools
32-
#
33-
# What it doesn't do:
34-
# Provide linkage to the parent modules i.e. Particle, QMCHamiltonians,
35-
# QMCWaveFunction.
36-
#
37-
# It may be used faciliate transition to single compilation of the
38-
# minimal pools without a great deal of mess in the various test
39-
# program builds however it is useful as is. Consult with PD before
40-
# reverting this.
41-
#
42-
43-
add_library(minimal_testing_pools INTERFACE)
44-
target_sources(minimal_testing_pools INTERFACE MinimalParticlePool.h MinimalHamiltonianPool.h MinimalWaveFunctionPool.h)
45-
target_include_directories(minimal_testing_pools INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}")
46-
47-
add_library(minimal_particle_pool MinimalParticlePool.cpp)
48-
target_include_directories(minimal_particle_pool PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
49-
target_link_libraries(minimal_particle_pool PUBLIC qmcparticle)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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) 2025 QMCPACK developers.
6+
//
7+
// File developed by: Peter W. Doak, [email protected], Oak Ridge National Laboratory
8+
//////////////////////////////////////////////////////////////////////////////////////
9+
10+
#include "MinimalHamiltonianPool.h"
11+
#include "OhmmsData/Libxml2Doc.h"
12+
13+
namespace qmcplusplus
14+
{
15+
16+
// See src/QMCHamiltonians/tests/test_hamiltonian_factory for parsing tests
17+
static constexpr const char* const hamiltonian_xml = R"(
18+
<hamiltonian name="h0" type="generic" target="e">
19+
<pairpot type="coulomb" name="ElecElec" source="e" target="e"/>
20+
</hamiltonian>
21+
)";
22+
23+
static constexpr const char* const hamiltonian_eeei_xml = R"(
24+
<hamiltonian name="h0" type="generic" target="e">
25+
<pairpot type="coulomb" name="ElecElec" source="e" target="e"/>
26+
<pairpot type="coulomb" name="ElecIon" source="ion" target="e"/>
27+
</hamiltonian>
28+
)";
29+
30+
HamiltonianPool MinimalHamiltonianPool::make_hamWithEE(Communicate* comm,
31+
ParticleSetPool& particle_pool,
32+
WaveFunctionPool& wavefunction_pool)
33+
{
34+
HamiltonianPool hpool(particle_pool, wavefunction_pool, comm);
35+
Libxml2Document doc;
36+
doc.parseFromString(hamiltonian_xml);
37+
38+
xmlNodePtr root = doc.getRoot();
39+
hpool.put(root);
40+
41+
return hpool;
42+
}
43+
44+
HamiltonianPool MinimalHamiltonianPool::makeHamWithEEEI(Communicate* comm,
45+
ParticleSetPool& particle_pool,
46+
WaveFunctionPool& wavefunction_pool)
47+
{
48+
HamiltonianPool hpool(particle_pool, wavefunction_pool, comm);
49+
Libxml2Document doc;
50+
doc.parseFromString(hamiltonian_eeei_xml);
51+
52+
xmlNodePtr root = doc.getRoot();
53+
hpool.put(root);
54+
55+
return hpool;
56+
}
57+
58+
59+
} // namespace qmcplusplus

src/integration_testing/MinimalHamiltonianPool.h

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,48 +21,13 @@ namespace qmcplusplus
2121
{
2222
class MinimalHamiltonianPool
2323
{
24-
// See src/QMCHamiltonians/tests/test_hamiltonian_factory for parsing tests
25-
static constexpr const char* const hamiltonian_xml = R"(
26-
<hamiltonian name="h0" type="generic" target="e">
27-
<pairpot type="coulomb" name="ElecElec" source="e" target="e"/>
28-
</hamiltonian>
29-
)";
30-
31-
static constexpr const char* const hamiltonian_eeei_xml = R"(
32-
<hamiltonian name="h0" type="generic" target="e">
33-
<pairpot type="coulomb" name="ElecElec" source="e" target="e"/>
34-
<pairpot type="coulomb" name="ElecIon" source="ion" target="e"/>
35-
</hamiltonian>
36-
)";
37-
3824
public:
3925
static HamiltonianPool make_hamWithEE(Communicate* comm,
4026
ParticleSetPool& particle_pool,
41-
WaveFunctionPool& wavefunction_pool)
42-
{
43-
HamiltonianPool hpool(particle_pool, wavefunction_pool, comm);
44-
Libxml2Document doc;
45-
doc.parseFromString(hamiltonian_xml);
46-
47-
xmlNodePtr root = doc.getRoot();
48-
hpool.put(root);
49-
50-
return hpool;
51-
}
52-
27+
WaveFunctionPool& wavefunction_pool);
5328
static HamiltonianPool makeHamWithEEEI(Communicate* comm,
5429
ParticleSetPool& particle_pool,
55-
WaveFunctionPool& wavefunction_pool)
56-
{
57-
HamiltonianPool hpool(particle_pool, wavefunction_pool, comm);
58-
Libxml2Document doc;
59-
doc.parseFromString(hamiltonian_eeei_xml);
60-
61-
xmlNodePtr root = doc.getRoot();
62-
hpool.put(root);
63-
64-
return hpool;
65-
}
30+
WaveFunctionPool& wavefunction_pool);
6631
};
6732

6833
} // namespace qmcplusplus

src/integration_testing/MinimalParticlePoll.cpp

Whitespace-only changes.

src/integration_testing/MinimalParticlePool.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
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) 2025 QMCPACK developers.
6+
//
7+
// File developed by: Peter W. Doak, [email protected], Oak Ridge National Laboratory
8+
//////////////////////////////////////////////////////////////////////////////////////
9+
110
#include "MinimalParticlePool.h"
211

312
namespace qmcplusplus
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
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) 2025 QMCPACK developers.
6+
//
7+
// File developed by: Peter W. Doak, [email protected], Oak Ridge National Laboratory
8+
//////////////////////////////////////////////////////////////////////////////////////
9+
10+
#include "MinimalWaveFunctionPool.h"
11+
#include "OhmmsData/Libxml2Doc.h"
12+
13+
namespace qmcplusplus
14+
{
15+
16+
static constexpr const char* const wf_input = R"(
17+
<wavefunction target='e'>
18+
<sposet_collection type="bspline" source="ion" href="diamondC_1x1x1.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" meshfactor="0.8" twist="0 0 0" precision="double">
19+
<sposet name="spo_for_dets" size="4" spindataset="0"/>
20+
</sposet_collection>
21+
<sposet_collection type="bspline" source="ion" href="diamondC_1x1x1.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" gpu="no" meshfactor="0.8" twist="0 0 0" precision="double">
22+
<sposet name="spo_ud" size="4" spindataset="0"/>
23+
<sposet name="spo_dm" index_min="4" index_max="8" spindataset="0"/>
24+
</sposet_collection>
25+
<determinantset>
26+
<slaterdeterminant>
27+
<determinant sposet='spo_for_dets'/>
28+
<determinant sposet='spo_for_dets'/>
29+
</slaterdeterminant>
30+
</determinantset>
31+
</wavefunction>
32+
)";
33+
34+
static constexpr const char* const wf_input_spinor = R"(
35+
<wavefunction name="psi0" target="e">
36+
<sposet_collection name="A" type="einspline" href="o2_45deg_spins.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion0" size="12">
37+
<sposet name="spo_ud" size="12"/>
38+
<sposet name="spo_dm" size="8" index_min="12" index_max="20"/>
39+
</sposet_collection>
40+
<determinantset>
41+
<slaterdeterminant>
42+
<determinant sposet="spo_ud"/>
43+
</slaterdeterminant>
44+
</determinantset>
45+
</wavefunction>
46+
)";
47+
48+
static constexpr const char* const wf_input_spinor_J12 = R"(
49+
<wavefunction name="psi0" target="e">
50+
<sposet_collection name="A" type="einspline" href="o2_45deg_spins.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" source="ion0" size="12">
51+
<sposet name="spo_ud" size="12"/>
52+
<sposet name="spo_dm" size="8" index_min="12" index_max="20"/>
53+
</sposet_collection>
54+
<determinantset>
55+
<slaterdeterminant>
56+
<determinant sposet="spo_ud"/>
57+
</slaterdeterminant>
58+
</determinantset>
59+
<jastrow type="One-Body" name="J1" function="bspline" source="ion0" print="yes">
60+
<correlation elementType="O" size="9" rcut="2.336894584512495" cusp="0.0">
61+
<coefficients id="eO" type="Array">
62+
-0.51632 -0.1591167977 -0.172367432 -0.1238310413 -0.09792672786
63+
-0.91785 -0.05476753103 -0.03482448615 -0.01864350288
64+
</coefficients>
65+
</correlation>
66+
</jastrow>
67+
<jastrow type="Two-Body" name="J2" function="bspline" print="yes">
68+
<correlation speciesA="u" speciesB="u" size="9" rcut="2.336894584512495" cusp="-0.5">
69+
<coefficients id="uu" type="Array">
70+
0.7554 0.5342428628 0.3861610501 0.2724177345 0.186010153 0.1213795099
71+
0.04796 0.04068638111 0.01968948012
72+
</coefficients>
73+
</correlation>
74+
</jastrow>
75+
</wavefunction>
76+
)";
77+
78+
WaveFunctionPool MinimalWaveFunctionPool::make_diamondC_1x1x1(const RuntimeOptions& runtime_options,
79+
Communicate* comm,
80+
ParticleSetPool& particle_pool)
81+
{
82+
WaveFunctionPool wp(runtime_options, particle_pool, comm);
83+
84+
Libxml2Document doc;
85+
bool okay = doc.parseFromString(wf_input);
86+
87+
xmlNodePtr root = doc.getRoot();
88+
89+
wp.put(root);
90+
91+
return wp;
92+
}
93+
94+
WaveFunctionPool MinimalWaveFunctionPool::make_O2_spinor(const RuntimeOptions& runtime_options,
95+
Communicate* comm,
96+
ParticleSetPool& particle_pool)
97+
{
98+
WaveFunctionPool wp(runtime_options, particle_pool, comm);
99+
100+
Libxml2Document doc;
101+
bool okay = doc.parseFromString(wf_input_spinor);
102+
103+
xmlNodePtr root = doc.getRoot();
104+
105+
wp.put(root);
106+
107+
return wp;
108+
}
109+
110+
WaveFunctionPool MinimalWaveFunctionPool::make_O2_spinor_J12(const RuntimeOptions& runtime_options,
111+
Communicate* comm,
112+
ParticleSetPool& particle_pool)
113+
{
114+
WaveFunctionPool wp(runtime_options, particle_pool, comm);
115+
116+
Libxml2Document doc;
117+
bool okay = doc.parseFromString(wf_input_spinor_J12);
118+
119+
xmlNodePtr root = doc.getRoot();
120+
121+
wp.put(root);
122+
123+
return wp;
124+
}
125+
126+
} // namespace qmcplusplus

0 commit comments

Comments
 (0)