Skip to content

Commit a4a9164

Browse files
committed
Add the elec_ampl argument for proper initialization
1 parent 9847494 commit a4a9164

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libra_py/dynamics/ldr_torch/compute.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ def __init__(self, params):
5151
self.ngrids = len(self.qgrid) # N
5252
self.nstates = params.get("nstates", 2)
5353
self.istate = params.get("istate", 0)
54-
54+
self.elec_ampl = params.get("elec_ampl", torch.tensor([1.0+0.j]*self.ngrids, dtype=torch.cdouble))
55+
5556
self.save_every_n_steps = params.get("save_every_n_steps", 1)
5657
self.properties_to_save = params.get("properties_to_save", ["time", "population_right"])
5758
self.dt = params.get("dt", 0.01)
@@ -220,7 +221,7 @@ def initialize_C(self):
220221
delta_eta = -0.5 * torch.dot(xi0 + p0, q0) + 0.5 * torch.dot(xig, qgrid[n]).conj()
221222
exponent = -1.j * 0.5 * torch.dot(delta_xi, torch.matmul(delta_A_inv, delta_xi)) + 1.j * delta_eta
222223

223-
self.C0[index] = torch.exp(exponent)
224+
self.C0[index] = self.elec_ampl[n] * torch.exp(exponent)
224225

225226
# Normalize
226227
overlap = torch.matmul(self.S, self.C0)

0 commit comments

Comments
 (0)