From 26307d95c40a08954dcdefb9a793555ae3f5562e Mon Sep 17 00:00:00 2001 From: Xavier Andrade Date: Wed, 23 Oct 2024 13:38:27 -0700 Subject: [PATCH 1/4] Integrate the 2pi factor in the metric object instead of dividing every time. --- src/basis/containing_cube.hpp | 2 +- src/systems/cell.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/basis/containing_cube.hpp b/src/basis/containing_cube.hpp index 2ca4765a..e8d212f4 100644 --- a/src/basis/containing_cube.hpp +++ b/src/basis/containing_cube.hpp @@ -78,7 +78,7 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) { CHECK(lo[1] == -3); CHECK(lo[2] == -6); CHECK(hi[0] == 18); - CHECK(hi[1] == 17); + CHECK(hi[1] == 16); CHECK(hi[2] == 13); for(int ix = 0; ix < rs.sizes()[0]; ix++){ diff --git a/src/systems/cell.hpp b/src/systems/cell.hpp index 60fc84e6..89f5d268 100644 --- a/src/systems/cell.hpp +++ b/src/systems/cell.hpp @@ -155,7 +155,7 @@ namespace systems { for(int ii = 0; ii < 3; ii++){ for(int jj = 0; jj < 3; jj++){ lat_[ii][jj] = aa[ii][jj]; - rlat_[ii][jj] = bb[ii][jj]; + rlat_[ii][jj] = bb[ii][jj]/(2.0*M_PI); } } @@ -203,7 +203,7 @@ namespace systems { template GPU_FUNCTION auto to_contravariant(vector3 const & vv) const { - return vector3{rlat_[0].dot(vv), rlat_[1].dot(vv), rlat_[2].dot(vv)}/(2.0*M_PI); + return vector3{rlat_[0].dot(vv), rlat_[1].dot(vv), rlat_[2].dot(vv)}; } template @@ -218,7 +218,7 @@ namespace systems { template GPU_FUNCTION auto to_cartesian(vector3 const & vv) const { - return (rlat_[0]*vv[0] + rlat_[1]*vv[1] + rlat_[2]*vv[2])/(2.0*M_PI); + return (rlat_[0]*vv[0] + rlat_[1]*vv[1] + rlat_[2]*vv[2]); } }; From 742eb088f4554d00865bc8b856c1e0561e4fca7d Mon Sep 17 00:00:00 2001 From: Xavier Andrade Date: Wed, 23 Oct 2024 15:00:34 -0700 Subject: [PATCH 2/4] Tighten convergence for the hydrogen_local test. --- tests/hydrogen_local.cpp | 62 ++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/tests/hydrogen_local.cpp b/tests/hydrogen_local.cpp index b48c3680..1b59986a 100644 --- a/tests/hydrogen_local.cpp +++ b/tests/hydrogen_local.cpp @@ -51,23 +51,23 @@ int main(int argc, char ** argv){ */ - energy_match.check("total energy", result.energy.total(), -0.499022720910); - energy_match.check("kinetic energy", result.energy.kinetic(), 0.488259135290); - energy_match.check("eigenvalues", result.energy.eigenvalues(),-0.499022720910); - energy_match.check("Hartree energy", result.energy.hartree(), 0.000000000000); - energy_match.check("external energy", result.energy.external(), -0.987281856200); - energy_match.check("non-local energy", result.energy.non_local(), 0.0); - energy_match.check("XC energy", result.energy.xc(), 0.0); - energy_match.check("XC density integral", result.energy.nvxc(), 0.0); - energy_match.check("HF exchange energy", result.energy.exact_exchange(), 0.0); - energy_match.check("ion-ion energy", result.energy.ion(), 0.000000000000); + energy_match.check("total energy", result.energy.total(), -0.499022722967); + energy_match.check("kinetic energy", result.energy.kinetic(), 0.488268502855); + energy_match.check("eigenvalues", result.energy.eigenvalues(), -0.499022722967); + energy_match.check("Hartree energy", result.energy.hartree(), 0.000000000000); + energy_match.check("external energy", result.energy.external(), -0.987291225822); + energy_match.check("non-local energy", result.energy.non_local(), 0.000000000000); + energy_match.check("XC energy", result.energy.xc(), 0.000000000000); + energy_match.check("XC density integral", result.energy.nvxc(), 0.000000000000); + energy_match.check("HF exchange energy", result.energy.exact_exchange(), 0.000000000000); + energy_match.check("ion-ion energy", result.energy.ion(), 0.000000000000); } // LDA { - auto result = inq::ground_state::calculate(ions, electrons, inq::options::theory{}.lda()); + auto result = inq::ground_state::calculate(ions, electrons, inq::options::theory{}.lda(), inq::options::ground_state{}.energy_tolerance(1e-8_Ha)); /* OCTOPUS RESULTS: (Spacing 0.286) @@ -94,15 +94,15 @@ int main(int argc, char ** argv){ */ - energy_match.check("total energy", result.energy.total(), -0.445162291231); - energy_match.check("kinetic energy", result.energy.kinetic(), 0.414318995673); - energy_match.check("eigenvalues", result.energy.eigenvalues(), -0.234026421108); - energy_match.check("Hartree energy", result.energy.hartree(), 0.281309443919); - energy_match.check("external energy", result.energy.external(), -0.909267595449); - energy_match.check("non-local energy", result.energy.non_local(), 0.0); - energy_match.check("XC energy", result.energy.xc(), -0.231518535506); - energy_match.check("XC density integral", result.energy.nvxc(), -0.301696709170); - energy_match.check("HF exchange energy", result.energy.exact_exchange(), 0.0); + energy_match.check("total energy", result.energy.total(), -0.445160072256); + energy_match.check("kinetic energy", result.energy.kinetic(), 0.414315464604); + energy_match.check("eigenvalues", result.energy.eigenvalues(), -0.234029035766); + energy_match.check("Hartree energy", result.energy.hartree(), 0.281309132025); + energy_match.check("external energy", result.energy.external(), -0.909266382097); + energy_match.check("non-local energy", result.energy.non_local(), 0.000000000000); + energy_match.check("XC energy", result.energy.xc(), -0.231518286787); + energy_match.check("XC density integral", result.energy.nvxc(), -0.301696382322); + energy_match.check("HF exchange energy", result.energy.exact_exchange(), 0.000000000000); energy_match.check("ion-ion energy", result.energy.ion(), 0.000000000000); } @@ -110,18 +110,18 @@ int main(int argc, char ** argv){ // B3LYP { - auto result = inq::ground_state::calculate(ions, electrons, inq::options::theory{}.b3lyp(), inq::options::ground_state{}.energy_tolerance(1e-6_Ha)); + auto result = inq::ground_state::calculate(ions, electrons, inq::options::theory{}.b3lyp(), inq::options::ground_state{}.energy_tolerance(1e-8_Ha)); - energy_match.check("total energy", result.energy.total(), -0.447426627140); - energy_match.check("kinetic energy", result.energy.kinetic(), 0.421674180797); - energy_match.check("eigenvalues", result.energy.eigenvalues(),-0.247447655678); - energy_match.check("Hartree energy", result.energy.hartree(), 0.282616005043); - energy_match.check("external energy", result.energy.external(), -0.916566570259); - energy_match.check("non-local energy", result.energy.non_local(), 0.000000000000); - energy_match.check("XC energy", result.energy.xc(), -0.206884719747); - energy_match.check("XC density integral", result.energy.nvxc(), -0.261264062460); - energy_match.check("HF exchange energy", result.energy.exact_exchange(),-0.028261606921); - energy_match.check("ion-ion energy", result.energy.ion(), 0.000000000000); + energy_match.check("total energy", result.energy.total(), -0.447429725736); + energy_match.check("kinetic energy", result.energy.kinetic(), 0.421657099440); + energy_match.check("eigenvalues", result.energy.eigenvalues(), -0.247459996333); + energy_match.check("Hartree energy", result.energy.hartree(), 0.282608756325); + energy_match.check("external energy", result.energy.external(), -0.916549935273); + energy_match.check("non-local energy", result.energy.non_local(), 0.000000000000); + energy_match.check("XC energy", result.energy.xc(), -0.206884771385); + energy_match.check("XC density integral", result.energy.nvxc(), -0.261262923463); + energy_match.check("HF exchange energy", result.energy.exact_exchange(), -0.028260874843); + energy_match.check("ion-ion energy", result.energy.ion(), 0.000000000000); } From 9e70d9f8b46febf651abde91b12afa640aec8db4 Mon Sep 17 00:00:00 2001 From: Xavier Andrade Date: Fri, 25 Oct 2024 11:09:52 -0700 Subject: [PATCH 3/4] Slight increase in tolerance for the hydrogen local test. --- tests/hydrogen_local.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/hydrogen_local.cpp b/tests/hydrogen_local.cpp index 1b59986a..35780377 100644 --- a/tests/hydrogen_local.cpp +++ b/tests/hydrogen_local.cpp @@ -113,10 +113,10 @@ int main(int argc, char ** argv){ auto result = inq::ground_state::calculate(ions, electrons, inq::options::theory{}.b3lyp(), inq::options::ground_state{}.energy_tolerance(1e-8_Ha)); energy_match.check("total energy", result.energy.total(), -0.447429725736); - energy_match.check("kinetic energy", result.energy.kinetic(), 0.421657099440); + energy_match.check("kinetic energy", result.energy.kinetic(), 0.421657099440, 7.0e-5); energy_match.check("eigenvalues", result.energy.eigenvalues(), -0.247459996333); energy_match.check("Hartree energy", result.energy.hartree(), 0.282608756325); - energy_match.check("external energy", result.energy.external(), -0.916549935273); + energy_match.check("external energy", result.energy.external(), -0.916549935273, 7.0e-5); energy_match.check("non-local energy", result.energy.non_local(), 0.000000000000); energy_match.check("XC energy", result.energy.xc(), -0.206884771385); energy_match.check("XC density integral", result.energy.nvxc(), -0.261262923463); From da5a4d5a2a701f75dcf180b0ee1d1c2fad83ef3e Mon Sep 17 00:00:00 2001 From: Xavier Andrade Date: Mon, 11 Nov 2024 11:52:45 -0800 Subject: [PATCH 4/4] Increase the number of SCF steps for the hybrid hydrogen local. --- tests/hydrogen_local.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/hydrogen_local.cpp b/tests/hydrogen_local.cpp index 35780377..0c115976 100644 --- a/tests/hydrogen_local.cpp +++ b/tests/hydrogen_local.cpp @@ -110,7 +110,7 @@ int main(int argc, char ** argv){ // B3LYP { - auto result = inq::ground_state::calculate(ions, electrons, inq::options::theory{}.b3lyp(), inq::options::ground_state{}.energy_tolerance(1e-8_Ha)); + auto result = inq::ground_state::calculate(ions, electrons, inq::options::theory{}.b3lyp(), inq::options::ground_state{}.energy_tolerance(1e-8_Ha).max_steps(300)); energy_match.check("total energy", result.energy.total(), -0.447429725736); energy_match.check("kinetic energy", result.energy.kinetic(), 0.421657099440, 7.0e-5);