Skip to content

Commit

Permalink
Merge branch 'bugfix_projector_commutator' into 'master'
Browse files Browse the repository at this point in the history
Bugfix: the position commutator for the non-local potential was not calculated correctly

See merge request npneq/inq!1179
  • Loading branch information
xavierandrade committed Dec 17, 2024
2 parents 5b0440f + b7a164b commit fbea34d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/hamiltonian/projector_all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ class projector_all {
[proj = begin(projections_all), rproj = begin(rprojections_all), coe = begin(coeff_)]
GPU_LAMBDA (auto ist, auto ilm, auto iproj){
proj[iproj][ilm][ist] *= coe[iproj][ilm];
proj[iproj][ilm][ist] *= coe[iproj][ilm];
rproj[iproj][ilm][ist] *= coe[iproj][ilm];
});
}

Expand Down
42 changes: 21 additions & 21 deletions src/observables/current.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,17 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) {

auto cur = observables::current(ions, electrons, ham);

CHECK(cur[0] == 125.4365980468_a);
CHECK(cur[1] == 5.708830041_a);
CHECK(cur[2] == 116.8317675488_a);
CHECK(cur[0] == 125.0726107094_a);
CHECK(cur[1] == 4.7292765308_a);
CHECK(cur[2] == 116.5420097097_a);

ham.uniform_vector_potential() = vector3<double, covariant>{1.0, -2.0, 3.0};

cur = observables::current(ions, electrons, ham);

CHECK(cur[0] == 87.3634379355_a);
CHECK(cur[1] == 81.8624161924_a);
CHECK(cur[2] == 2.7621022916_a);
CHECK(cur[0] == 87.0638041144_a);
CHECK(cur[1] == 80.6922069845_a);
CHECK(cur[2] == 2.5258837095_a);

}

Expand All @@ -223,9 +223,9 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) {

cur = observables::current(ions, electrons, ham);

CHECK(cur[0] == -13946.6008146884_a);
CHECK(cur[1] == 27893.1545901583_a);
CHECK(cur[2] == -41839.3257665369_a);
CHECK(cur[0] == -13655.6186604198_a);
CHECK(cur[1] == 27311.2419971710_a);
CHECK(cur[2] == -40966.6831884187_a);

}
}
Expand All @@ -244,17 +244,17 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) {

auto cur = observables::current(ions, electrons, ham);

CHECK(cur[0] == 65.7213690610_a);
CHECK(cur[1] == -53.8899219217_a);
CHECK(cur[2] == 57.1274385904_a);
CHECK(cur[0] == 65.3579017395_a);
CHECK(cur[1] == -54.9266021369_a);
CHECK(cur[2] == 56.8453806312_a);

ham.uniform_vector_potential() = vector3<double, covariant>{1.0, -2.0, 3.0};

cur = observables::current(ions, electrons, ham);

CHECK(cur[0] == 27.6768119377_a);
CHECK(cur[1] == 22.2401572043_a);
CHECK(cur[2] == -56.9484342345_a);
CHECK(cur[0] == 27.3599465174_a);
CHECK(cur[1] == 21.0517395749_a);
CHECK(cur[2] == -57.1448517995_a);

}

Expand All @@ -266,17 +266,17 @@ TEST_CASE(INQ_TEST_FILE, INQ_TEST_TAG) {

auto cur = observables::current(ions, electrons, ham);

CHECK(cur[0] == -21918.1030676834_a);
CHECK(cur[1] == -21918.0591750074_a);
CHECK(cur[2] == -21917.8247537255_a);
CHECK(cur[0] == -21452.9748736864_a);
CHECK(cur[1] == -21453.0100725570_a);
CHECK(cur[2] == -21452.8830570262_a);

ham.uniform_vector_potential() = vector3<double, covariant>{1.0, -2.0, 3.0};

cur = observables::current(ions, electrons, ham);

CHECK(cur[0] == -35804.3953857591_a);
CHECK(cur[1] == 5977.6646234487_a);
CHECK(cur[2] == -63658.5829715723_a);
CHECK(cur[0] == -35093.1574770241_a);
CHECK(cur[1] == 5859.0105019392_a);
CHECK(cur[2] == -62394.5776586859_a);

}
}
Expand Down
20 changes: 10 additions & 10 deletions tests/silicon_lrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ int main(int argc, char ** argv){
data_match.check("energy step 30", energy[30], -33.418518662296);
data_match.check("energy step 40", energy[40], -33.418518662423);

data_match.check("current in z step 0", jz[0], -0.157729547895);
data_match.check("current in z step 10", jz[10], -0.151911067747);
data_match.check("current in z step 20", jz[20], -0.144088608186);
data_match.check("current in z step 30", jz[30], -0.140191267000);
data_match.check("current in z step 40", jz[40], -0.135683835952);
data_match.check("current in z step 0", jz[0], -0.151225679030);
data_match.check("current in z step 10", jz[10], -0.146491063357);
data_match.check("current in z step 20", jz[20], -0.138514196446);
data_match.check("current in z step 30", jz[30], -0.132857574521);
data_match.check("current in z step 40", jz[40], -0.128278272499);

data_match.check("vector potential in z step 0", Az[0], 0.005000000000);
data_match.check("vector potential in z step 10", Az[10], 0.005000000000);
Expand Down Expand Up @@ -132,11 +132,11 @@ int main(int argc, char ** argv){
data_match.check("energy step 30", energy[30], -33.418517090347);
data_match.check("energy step 40", energy[40], -33.418515953351);

data_match.check("current in z step 0", jz[0], -0.157729547895);
data_match.check("current in z step 10", jz[10], -0.151948955175);
data_match.check("current in z step 20", jz[20], -0.144243229877);
data_match.check("current in z step 30", jz[30], -0.140534021619);
data_match.check("current in z step 40", jz[40], -0.136281715570);
data_match.check("current in z step 0", jz[0], -0.151225679030);
data_match.check("current in z step 10", jz[10], -0.146529575060);
data_match.check("current in z step 20", jz[20], -0.138664112001);
data_match.check("current in z step 30", jz[30], -0.133184328060);
data_match.check("current in z step 40", jz[40], -0.128841730136);

data_match.check("vector potential in z step 0", Az[0], 0.005000000000);
data_match.check("vector potential in z step 10", Az[10], 0.005001210192);
Expand Down

0 comments on commit fbea34d

Please sign in to comment.