Skip to content

Commit d68b650

Browse files
author
chrisjonesBSU
committed
Handle setting initial guess potential as entry in potential history
1 parent 37e66e5 commit d68b650

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

msibi/forces.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,9 @@ def set_polynomial(
544544
else:
545545
self.x_range = np.arange(x_min, x_max + self.dx, self.dx)
546546
self.potential = polynomial_potential(self.x_range, x0, k4, k3, k2)
547+
if self.optimize:
548+
# Store the initial guess as the first entry in potential_history
549+
self.potential_history.append(np.copy(self.potential))
547550
self.force_init = "Table"
548551
self.force_entry = self._table_entry()
549552

@@ -579,6 +582,9 @@ def set_from_file(self, file_path: str) -> None:
579582
self.x_max = self.x_range[-1] + self.dx
580583
self.force_init = "Table"
581584
self.nbins = len(self.x_range) - 1
585+
if self.optimize:
586+
# Store the initial guess as the first entry in potential_history
587+
self.potential_history.append(np.copy(self.potential))
582588

583589
def _add_state(self, state: msibi.state.State) -> None:
584590
"""Add a state to be used in optimizing this Force.

0 commit comments

Comments
 (0)