Skip to content

Commit

Permalink
Use dict.clear() to clear Parameter cache
Browse files Browse the repository at this point in the history
  • Loading branch information
loganbvh committed Apr 12, 2024
1 parent 74ccf26 commit 2bd0830
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tdgl/solver/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ def disorder_epsilon(r):

# Clear the Parameter caches
if isinstance(self.applied_vector_potential, Parameter):
self.applied_vector_potential._cache = {}
self.applied_vector_potential._cache.clear()
if isinstance(self.disorder_epsilon, Parameter):
self.disorder_epsilon._cache = {}
self.disorder_epsilon._cache.clear()

# Find the current terminal sites.
self.terminal_info = device.terminal_info()
Expand Down Expand Up @@ -807,9 +807,9 @@ def solve(self) -> Optional[Solution]:

# Clear the Parameter caches
if isinstance(self.applied_vector_potential, Parameter):
self.applied_vector_potential._cache = {}
self.applied_vector_potential._cache.clear()
if isinstance(self.disorder_epsilon, Parameter):
self.disorder_epsilon._cache = {}
self.disorder_epsilon._cache.clear()

solution = None
if data_was_generated:
Expand Down

0 comments on commit 2bd0830

Please sign in to comment.