Skip to content

Commit

Permalink
adding debug messages to solver
Browse files Browse the repository at this point in the history
  • Loading branch information
2AUK committed Aug 30, 2023
1 parent 2b982b8 commit ff2b040
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pyrism/Solvers/MDIIS.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,22 @@ def solve(self, RISM, Closure, lam, verbose=False):
except FloatingPointError as e:
print("Possible divergence")
print("iteration: {i}".format(i=i))
print("diff: {diff}".format(diff=(c_A-c_prev).sum()))
print("diff: {diff}".format(diff=(c_A-c_prev).min()))
raise e
if len(self.fr) < self.m:
c_next = self.step_Picard(c_A, c_prev)
RMS = np.sqrt(
1 / self.data_vv.ns1 / self.data_vv.grid.npts * np.power((c_A-c_prev).sum(), 2)
)
print("Iteration: {i}\nRMS: {RMS}\nDiff: {diff}".format(i=i, RMS=RMS, diff=(c_A-c_prev).min()))
self.RMS_res.append(RMS)
else:
c_next = self.step_MDIIS(c_A, c_prev, self.data_vv.t + c_A)
c_next = np.reshape(c_next, c_prev.shape)
RMS = np.sqrt(
1 / self.data_vv.ns1 / self.data_vv.grid.npts * np.power((c_A-c_prev).sum(), 2)
)
print("Iteration: {i}\nRMS: {RMS}\nDiff: {diff}".format(i=i, RMS=RMS, diff=(c_A-c_prev).min()))
if RMS > 10 * min(self.RMS_res):
min_index = self.RMS_res.index(min(self.RMS_res))
c_next = np.reshape(self.fr[min_index], c_prev.shape)
Expand Down

0 comments on commit ff2b040

Please sign in to comment.