Skip to content

Commit

Permalink
Merge branch 'normalize_metric' into 'master'
Browse files Browse the repository at this point in the history
Integrate the 2pi factor in the metric object instead of dividing every time

See merge request npneq/inq!1155
  • Loading branch information
xavierandrade committed Nov 11, 2024
2 parents c3c8a83 + da5a4d5 commit 01d8a97
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/basis/containing_cube.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++){
Expand Down
6 changes: 3 additions & 3 deletions src/systems/cell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -203,7 +203,7 @@ namespace systems {

template <class Type>
GPU_FUNCTION auto to_contravariant(vector3<Type, cartesian> const & vv) const {
return vector3<Type, contravariant>{rlat_[0].dot(vv), rlat_[1].dot(vv), rlat_[2].dot(vv)}/(2.0*M_PI);
return vector3<Type, contravariant>{rlat_[0].dot(vv), rlat_[1].dot(vv), rlat_[2].dot(vv)};
}

template <class Type>
Expand All @@ -218,7 +218,7 @@ namespace systems {

template <class Type>
GPU_FUNCTION auto to_cartesian(vector3<Type, covariant> 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]);
}

};
Expand Down
62 changes: 31 additions & 31 deletions tests/hydrogen_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -94,34 +94,34 @@ 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);

}

// 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).max_steps(300));

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, 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, 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);
energy_match.check("HF exchange energy", result.energy.exact_exchange(), -0.028260874843);
energy_match.check("ion-ion energy", result.energy.ion(), 0.000000000000);

}

Expand Down

0 comments on commit 01d8a97

Please sign in to comment.