Skip to content

Commit

Permalink
Merge pull request #2 from JackWetherell/master
Browse files Browse the repository at this point in the history
Fixed time-dependent reverse-engineering bug.
  • Loading branch information
JackWetherell authored Aug 10, 2022
2 parents 4b60848 + 393ce30 commit 290a18f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions iDEA/methods/hartree.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

kinetic_energy_operator = iDEA.methods.non_interacting.kinetic_energy_operator
external_potential_operator = iDEA.methods.non_interacting.external_potential_operator
propagate_step = iDEA.methods.non_interacting.propagate_step


def hartree_potential_operator(s: iDEA.system.System, n: np.ndarray) -> np.ndarray:
Expand Down
1 change: 1 addition & 0 deletions iDEA/methods/hartree_fock.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
kinetic_energy_operator = iDEA.methods.non_interacting.kinetic_energy_operator
external_potential_operator = iDEA.methods.non_interacting.external_potential_operator
hartree_potential_operator = iDEA.methods.hartree.hartree_potential_operator
propagate_step = iDEA.methods.non_interacting.propagate_step


def exchange_potential_operator(s: iDEA.system.System, p: np.ndarray) -> np.ndarray:
Expand Down
1 change: 1 addition & 0 deletions iDEA/methods/hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
exchange_correlation_potential_operator = (
iDEA.methods.lda.exchange_correlation_potential_operator
)
propagate_step = iDEA.methods.non_interacting.propagate_step


def hamiltonian(
Expand Down
1 change: 1 addition & 0 deletions iDEA/methods/lda.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
kinetic_energy_operator = iDEA.methods.non_interacting.kinetic_energy_operator
external_potential_operator = iDEA.methods.non_interacting.external_potential_operator
hartree_potential_operator = iDEA.methods.hartree.hartree_potential_operator
propagate_step = iDEA.methods.non_interacting.propagate_step


class HEG:
Expand Down
12 changes: 6 additions & 6 deletions iDEA/methods/non_interacting.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,13 @@ def propagate(
Propagate a set of orbitals forward in time due to a dynamic local pertubation.
| Args:
| s: iDEA.system.System, System object.
| state: iDEA.state.SingleBodyState, State to be propigated.
| v_ptrb: np.ndarray, Local perturbing potential on the grid of t and x values, indexed as v_ptrb[time,space].
| s: iDEA.system.System, System object.
| state: iDEA.state.SingleBodyState, State to be propigated.
| v_ptrb: np.ndarray, Local perturbing potential on the grid of t and x values, indexed as v_ptrb[time,space].
| t: np.ndarray, Grid of time values. \n
| hamiltonian_function: Callable, Hamiltonian function [If None this will be the non_interacting function]. (default = None)
| restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default=False)
| name: str, Name of method. (default = "non_interacting")
| hamiltonian_function: Callable, Hamiltonian function [If None this will be the non_interacting function]. (default = None)
| restricted: bool, Is the calculation restricted (r) on unrestricted (u). (default=False)
| name: str, Name of method. (default = "non_interacting")
| Returns:
| evolution: iDEA.state.SingleBodyEvolution, Solved time-dependent evolution.
Expand Down
4 changes: 3 additions & 1 deletion iDEA/observables.py
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,9 @@ def exchange_energy(
elif len(p.shape) == 3:
E_x = np.zeros(shape=p.shape[0], dtype=complex)
for j in range(E_x.shape[0]):
E_x[j] = 0.5 * np.tensordot(p[j, :, :].T, v_x[j, :, :], axes=2) * s.dx * s.dx
E_x[j] = (
0.5 * np.tensordot(p[j, :, :].T, v_x[j, :, :], axes=2) * s.dx * s.dx
)
return E_x.real

else:
Expand Down
5 changes: 4 additions & 1 deletion iDEA/reverse_engineering.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ def reverse_propagation(

# Reverse propagation.
for j, ti in enumerate(
tqdm(t, desc="iDEA.reverse_engineering.reverse_propagation: reversing propagation")
tqdm(
t,
desc="iDEA.reverse_engineering.reverse_propagation: reversing propagation",
)
):
if j != 0:

Expand Down
2 changes: 1 addition & 1 deletion iDEA/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(
r"""
State of particles in a many-body state.
This is described by a spatial part
This is described by a spatial part
.. math:: \psi(x_1,x_2,\dots,x_N)
on the spatial grid, and a spin
part on the spin grid
Expand Down

0 comments on commit 290a18f

Please sign in to comment.