Skip to content

Commit

Permalink
Merge pull request #17 from PGelss/PGelss-patch-krylov
Browse files Browse the repository at this point in the history
Krylov methods with reduced and full orthonormalization
  • Loading branch information
PGelss authored Sep 3, 2024
2 parents 7fd13dd + 4a46208 commit 18ab5c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = wave_train
version = 1.0.11
version = 1.0.12
author = Jerome Riedel, Patrick Gelß, Burkhard Schmidt
author_email = [email protected]
description = Numerical quantum mechanics of chain-like systems based on tensor trains
Expand Down
10 changes: 7 additions & 3 deletions wave_train/dynamics/tdse.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,13 @@ def update_solve(self, i):
elif self.solver == 'vp': # time-dependent variational principle
psi = ode.tdvp(1j*self.operator, initial_value=self.psi, step_size=self.sub_size,
number_of_steps=self.sub_steps, normalize=self.normalize)
elif self.solver in ['k2', 'k4', 'k6', 'k8']: # Krylov subspace method
elif self.solver in ['f2', 'f4', 'f6', 'f8']: # Krylov subspace method with full orthonormalization
for step in range(self.sub_steps):
self.psi = ode.krylov(1j*self.operator, initial_value=self.psi, dimension=int(self.solver[1]), step_size=self.sub_size, threshold=self.threshold,
self.psi = ode.krylov_full(1j*self.operator, initial_value=self.psi, dimension=int(self.solver[1]), step_size=self.sub_size, threshold=self.threshold,
max_rank=self.max_rank, normalize=self.normalize)
elif self.solver in ['r2', 'r4', 'r6', 'r8']: # Krylov subspace method with reduced orthonormalization
for step in range(self.sub_steps):
self.psi = ode.krylov_reduced(1j*self.operator, initial_value=self.psi, dimension=int(self.solver[1]), step_size=self.sub_size, threshold=self.threshold,
max_rank=self.max_rank, normalize=self.normalize)
elif self.solver == 'qe': # Quasi-exact propagation
self.psi = self.propagator @ self.psi
Expand All @@ -447,7 +451,7 @@ def update_solve(self, i):
sys.exit('Wrong choice of solver')

# Prepare for next time step
if self.solver not in ['qe', 'k2', 'k4', 'k6', 'k8']:
if self.solver not in ['qe', 'f2', 'f4', 'f6', 'f8', 'r2', 'r4', 'r6', 'r8']:
self.psi = psi[-1]
self.psi_guess = self.psi

Expand Down

0 comments on commit 18ab5c7

Please sign in to comment.