From 4539a72a6847238d5be9598b6cb8c71072100c07 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Mon, 2 Mar 2026 12:49:20 -0600 Subject: [PATCH 1/2] adds_tests --- .../integration_tests/driver/scf_driver.cpp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/cxx/integration_tests/driver/scf_driver.cpp b/tests/cxx/integration_tests/driver/scf_driver.cpp index 33e2dd9..b01bf3b 100644 --- a/tests/cxx/integration_tests/driver/scf_driver.cpp +++ b/tests/cxx/integration_tests/driver/scf_driver.cpp @@ -26,11 +26,23 @@ TEMPLATE_LIST_TEST_CASE("SCFDriver", "", test_scf::float_types) { tensorwrapper::shape::Smooth shape_corr{}; auto pcorr = make_contiguous(shape_corr); + SECTION("He") { + auto he = test_scf::make_he(); + auto aos = test_scf::he_aos().ao_basis_set(); + + // Correct energy is validated against Psi4 + pcorr.set_elem({}, float_type{-2.8077839566141960}); + simde::type::tensor corr(shape_corr, std::move(pcorr)); + const auto e = mm.template run_as("SCF Driver", aos, he); + REQUIRE(approximately_equal(corr, e, 1E-6)); + } + SECTION("H2") { auto h2 = test_scf::make_h2(); auto aos = test_scf::h2_aos().ao_basis_set(); SECTION("SCF") { + // Correct energy is validated against Psi4 pcorr.set_elem({}, float_type{-1.1167592336}); simde::type::tensor corr(shape_corr, std::move(pcorr)); const auto e = mm.template run_as("SCF Driver", aos, h2); @@ -56,6 +68,7 @@ TEMPLATE_LIST_TEST_CASE("SCFDriver", "", test_scf::float_types) { } SECTION("H2 Dimer") { + // Correct energy is validated against Psi4 simde::type::nucleus h0("H", 1ul, 1836.15, 0.0, 0.0, 0.0); simde::type::nucleus h1("H", 1ul, 1836.15, 0.0, 0.0, 1.39839); simde::type::nucleus h2("H", 1ul, 1836.15, 0.0, 0.0, 4.39839); @@ -70,4 +83,26 @@ TEMPLATE_LIST_TEST_CASE("SCFDriver", "", test_scf::float_types) { simde::type::tensor corr(shape_corr, std::move(pcorr)); REQUIRE(approximately_equal(corr, e, 1E-6)); } + + SECTION("Water") { + using atom_t = simde::type::atom; + using molecule_t = simde::type::molecule; + const auto a2b = 1.8897259886; // Angstroms to bohrs + const auto H_mass = 1822.877; // Hydrogen mass in atomic units + const auto O_mass = 29166.037; // Oxygen mass in atomic units + atom_t H0("H", 1ul, H_mass, -1.958940 * a2b, -0.032063 * a2b, + 0.725554 * a2b); + atom_t H1("H", 1ul, H_mass, -0.607485 * a2b, 0.010955 * a2b, + 0.056172 * a2b); + atom_t O0("O", 8ul, O_mass, -1.538963, 0.004548, -0.117331); + molecule_t water{H0, H1, O0}; + auto aos = + mm.template run_as("STO-3G", water); + + simde::type::chemical_system water_cs(water); + auto e = mm.template run_as("SCF Driver", aos, water_cs); + // pcorr.set_elem({}, float_type{-74.9603445303}); + // REQUIRE(approximately_equal(corr, e, 1E-6)); + std::cout << e << std::endl; + } } From e2937b98bd756a23ba988360da0e49afcba1ed49 Mon Sep 17 00:00:00 2001 From: "Ryan M. Richard" Date: Mon, 2 Mar 2026 13:11:36 -0600 Subject: [PATCH 2/2] adds more tests --- tests/cxx/integration_tests/driver/scf_driver.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/cxx/integration_tests/driver/scf_driver.cpp b/tests/cxx/integration_tests/driver/scf_driver.cpp index b01bf3b..e0e7f01 100644 --- a/tests/cxx/integration_tests/driver/scf_driver.cpp +++ b/tests/cxx/integration_tests/driver/scf_driver.cpp @@ -94,15 +94,16 @@ TEMPLATE_LIST_TEST_CASE("SCFDriver", "", test_scf::float_types) { 0.725554 * a2b); atom_t H1("H", 1ul, H_mass, -0.607485 * a2b, 0.010955 * a2b, 0.056172 * a2b); - atom_t O0("O", 8ul, O_mass, -1.538963, 0.004548, -0.117331); + atom_t O0("O", 8ul, O_mass, -1.538963 * a2b, 0.004548 * a2b, + -0.117331 * a2b); molecule_t water{H0, H1, O0}; auto aos = mm.template run_as("STO-3G", water); simde::type::chemical_system water_cs(water); auto e = mm.template run_as("SCF Driver", aos, water_cs); - // pcorr.set_elem({}, float_type{-74.9603445303}); - // REQUIRE(approximately_equal(corr, e, 1E-6)); - std::cout << e << std::endl; + pcorr.set_elem({}, float_type{-74.9602586404361944}); + simde::type::tensor corr(shape_corr, std::move(pcorr)); + REQUIRE(approximately_equal(corr, e, 1E-6)); } }