Skip to content

Commit 0b5baa6

Browse files
Merge branch 'fix_time_direction' into 'master'
Bugfix: time direction in the propagation was reversed See merge request npneq/inq!1274
2 parents e8d2779 + 3712a5a commit 0b5baa6

4 files changed

Lines changed: 44 additions & 33 deletions

File tree

src/real_time/etrs.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void etrs(double const time, double const dt, systems::ions & ions, systems::ele
3232
for(auto & phi : electrons.kpin()){
3333

3434
//propagate half step and full step with H(t)
35-
auto halfstep_phi = operations::exponential_2_for_1(ham, complex(0.0, dt/2.0), complex(0.0, dt), phi);
35+
auto halfstep_phi = operations::exponential_2_for_1(ham, complex(0.0, -dt/2.0), complex(0.0, -dt), phi);
3636
{ CALI_CXX_MARK_SCOPE("etrs:save");
3737
save.emplace_back(std::move(halfstep_phi));
3838
}
@@ -61,7 +61,7 @@ void etrs(double const time, double const dt, systems::ions & ions, systems::ele
6161
int iphi = 0;
6262
for(auto & phi : electrons.kpin()) {
6363
if(iscf != 0) phi = save[iphi];
64-
operations::exponential_in_place(ham, complex(0.0, dt/2.0), phi);
64+
operations::exponential_in_place(ham, complex(0.0, -dt/2.0), phi);
6565
iphi++;
6666
}
6767

tests/h2+_absorption.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ inq util match `inq results rt dipole 0 x` -1.541248082814758143
5353
inq util match `inq results rt dipole 0 y` -1.54124808014932277930e-03 3e-5
5454

5555
inq util match `inq results rt dipole 0` -1.54124808281475814305e-03 -1.54124808014932277930e-03 -3.18539677983979620680e-04 3e-5
56-
inq util match `inq results rt dipole 250` -1.54615234532997779422e-03 -1.54615234914674175640e-03 2.14187233787422916242e-02 3e-5
57-
inq util match `inq results rt dipole 500` -1.54334128450166500543e-03 -1.54334128304983372870e-03 8.97097561028314602338e-03 3e-5
58-
inq util match `inq results rt dipole 750` -1.54194820177244642373e-03 -1.54194820262243642399e-03 -1.79777352895105942132e-02 3e-5
59-
inq util match `inq results rt dipole 1000` -1.54130017749138726116e-03 -1.54130016731222983101e-03 -1.72305596896911057681e-02 3e-5
60-
inq util match `inq results rt dipole 1250` -1.54237594471584344054e-03 -1.54237595285780125162e-03 1.00418523973392712773e-02 3e-5
61-
inq util match `inq results rt dipole 1500` -1.53780963116460864942e-03 -1.53780963394002006053e-03 2.11680482416481442753e-02 3e-5
62-
inq util match `inq results rt dipole 1750` -1.54273831826737956030e-03 -1.54273831975235533112e-03 -1.54542217063192597812e-03 3e-5
63-
inq util match `inq results rt dipole 2000` -1.54542886241270673552e-03 -1.54542887026533934218e-03 -2.22503596592770538920e-02 3e-5
56+
inq util match `inq results rt dipole 250` -1.53715512837854792819e-03 -1.53715513055107852979e-03 -2.20572792225880963402e-02 3e-5
57+
inq util match `inq results rt dipole 500` -1.53906074142993488929e-03 -1.53906073191713266800e-03 -9.61422811969275641075e-03 3e-5
58+
inq util match `inq results rt dipole 750` -1.54546517863648428387e-03 -1.54546518301039068587e-03 1.73412993574253576634e-02 3e-5
59+
inq util match `inq results rt dipole 1000` -1.54496267187288608726e-03 -1.54496265723247784389e-03 1.65933169828854504280e-02 3e-5
60+
inq util match `inq results rt dipole 1250` -1.54117965601463578589e-03 -1.54117965838824013715e-03 -1.06809681678022728307e-02 3e-5
61+
inq util match `inq results rt dipole 1500` -1.54114528104081047362e-03 -1.54114527851972925657e-03 -2.18011257603510054393e-02 3e-5
62+
inq util match `inq results rt dipole 1750` -1.54132025443926706787e-03 -1.54132024461676292969e-03 9.09655537626315527366e-04 3e-5
63+
inq util match `inq results rt dipole 2000` -1.53949216003116339489e-03 -1.53949217012619974689e-03 2.16152517670456442711e-02 3e-5

tests/h2o.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ int main(int argc, char ** argv){
139139
real_time::propagate<>(ions, electrons, output, options::theory{}.lda(), options::real_time{}.num_steps(nsteps).dt(0.055_atomictime), kick);
140140

141141
match.check("ETRS length kick: dipole step 0", dip[0], -0.000309741032);
142-
match.check("ETRS length kick: dipole step 10", dip[10], 0.352439452823);
143-
match.check("ETRS length kick: dipole step 20", dip[20], 0.516924511546);
144-
match.check("ETRS length kick: dipole step 30", dip[30], 0.552695897606);
145-
match.check("ETRS length kick: dipole step 40", dip[40], 0.505285716066);
146-
match.check("ETRS length kick: dipole step 50", dip[50], 0.408432017486);
147-
match.check("ETRS length kick: dipole step 60", dip[60], 0.286408872554);
148-
match.check("ETRS length kick: dipole step 70", dip[70], 0.162609145400);
142+
match.check("ETRS length kick: dipole step 10", dip[10], -0.353225338482);
143+
match.check("ETRS length kick: dipole step 20", dip[20], -0.517982705117);
144+
match.check("ETRS length kick: dipole step 30", dip[30], -0.554109329493);
145+
match.check("ETRS length kick: dipole step 40", dip[40], -0.506630768030);
146+
match.check("ETRS length kick: dipole step 50", dip[50], -0.411072088843);
147+
match.check("ETRS length kick: dipole step 60", dip[60], -0.293501486218);
148+
match.check("ETRS length kick: dipole step 70", dip[70], -0.174726584012);
149149

150150
match.check("ETRS length kick: energy step 0", en[0], -17.563616880918);
151151
match.check("ETRS length kick: energy step 10", en[10], -17.563606697534);
@@ -191,9 +191,9 @@ int main(int argc, char ** argv){
191191
real_time::propagate<>(ions, electrons, output, options::theory{}.lda(), options::real_time{}.num_steps(nsteps).dt(0.055_atomictime), kick1 + kick2);
192192

193193
match.check("ETRS velocity kick: dipole step 0", dip[0], -0.000309741032);
194-
match.check("ETRS velocity kick: dipole step 10", dip[10], 0.352042693691);
195-
match.check("ETRS velocity kick: dipole step 20", dip[20], 0.516780678116);
196-
match.check("ETRS velocity kick: dipole step 30", dip[30], 0.552957962009);
194+
match.check("ETRS velocity kick: dipole step 10", dip[10], -0.352667764228);
195+
match.check("ETRS velocity kick: dipole step 20", dip[20], -0.517468633127);
196+
match.check("ETRS velocity kick: dipole step 30", dip[30], -0.553770289583);
197197

198198
match.check("ETRS velocity kick: energy step 0", en[0], -17.563920909871);
199199
match.check("ETRS velocity kick: energy step 10", en[10], -17.563906701155);
@@ -236,9 +236,9 @@ int main(int argc, char ** argv){
236236
real_time::propagate<>(ions, electrons, output, options::theory{}.lda(), options::real_time{}.num_steps(nsteps).dt(0.055_atomictime), perts);
237237

238238
match.check("ETRS length kick: dipole step 0", dip[0], -0.000309741032);
239-
match.check("ETRS length kick: dipole step 10", dip[10], 0.352439452823);
240-
match.check("ETRS length kick: dipole step 20", dip[20], 0.516924511546);
241-
match.check("ETRS length kick: dipole step 30", dip[30], 0.552695897606);
239+
match.check("ETRS length kick: dipole step 10", dip[10], -0.353225338482);
240+
match.check("ETRS length kick: dipole step 20", dip[20], -0.517982705117);
241+
match.check("ETRS length kick: dipole step 30", dip[30], -0.554109329493);
242242

243243
match.check("ETRS length kick: energy step 0", en[0], -17.563616880918);
244244
match.check("ETRS length kick: energy step 10", en[10], -17.563606697534);

tests/na2+.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,27 @@
8181
print(dipole[3000])
8282

8383
assert pinq.util.match(dipole[ 0], [-0.17853907, -0.17853954, -0.22782616], 3e-5)
84-
assert pinq.util.match(dipole[ 10], [-0.178539 , -0.17853941, -0.22839654], 3e-5)
85-
assert pinq.util.match(dipole[ 300], [-0.1784962 , -0.17849663, -0.22849769], 3e-5)
86-
assert pinq.util.match(dipole[ 444], [-0.17851319, -0.17851274, -0.22856397], 3e-5)
87-
assert pinq.util.match(dipole[1000], [-0.1785875 , -0.17858712, -0.22776555], 3e-5)
88-
assert pinq.util.match(dipole[1663], [-0.17841327, -0.17841309, -0.22773484], 3e-5)
89-
assert pinq.util.match(dipole[2000], [-0.1786417 , -0.1786419 , -0.2278392 ], 3e-5)
90-
assert pinq.util.match(dipole[2101], [-0.17843316, -0.1784334 , -0.22758917], 3e-5)
91-
assert pinq.util.match(dipole[2748], [-0.17855025, -0.17855 , -0.2274164 ], 3e-5)
92-
assert pinq.util.match(dipole[2937], [-0.17853585, -0.17853627, -0.22748399], 3e-5)
93-
assert pinq.util.match(dipole[3000], [-0.17857928, -0.17857941, -0.22809489], 3e-5)
84+
assert pinq.util.match(dipole[ 10], [-0.17853874, -0.17853918, -0.22725359], 3e-5)
85+
assert pinq.util.match(dipole[ 300], [-0.17849614, -0.17849658, -0.22702969], 3e-5)
86+
assert pinq.util.match(dipole[ 444], [-0.17851313, -0.17851268, -0.22688299], 3e-5)
87+
assert pinq.util.match(dipole[1000], [-0.17858653, -0.17858627, -0.22790895], 3e-5)
88+
assert pinq.util.match(dipole[1663], [-0.17841394, -0.17841367, -0.22739329], 3e-5)
89+
assert pinq.util.match(dipole[2000], [-0.17864295, -0.17864298, -0.22787972], 3e-5)
90+
assert pinq.util.match(dipole[2101], [-0.17843268, -0.17843301, -0.22777313], 3e-5)
91+
assert pinq.util.match(dipole[2748], [-0.17854898, -0.17854889, -0.22804299], 3e-5)
92+
assert pinq.util.match(dipole[2937], [-0.17853679, -0.17853709, -0.2280557 ], 3e-5)
93+
assert pinq.util.match(dipole[3000], [-0.17857866, -0.17857888, -0.22764393], 3e-5)
94+
95+
96+
97+
98+
99+
100+
101+
102+
103+
104+
94105

95106

96107

0 commit comments

Comments
 (0)