Skip to content

Commit 1c04f57

Browse files
committed
Fixed the error on the step
1 parent dd4f388 commit 1c04f57

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

Modules/Minimizer.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,16 @@ def get_dyn_struct(self):
187187
struct = self.current_x[self.nq * self.n_modes * self.n_modes :].reshape(self.dyn.structure.coords.shape)
188188
return dynq, struct
189189

190+
def is_new_direction(self):
191+
"""
192+
Return if a new direction must be chosen.
193+
"""
194+
195+
if self.fixed_step:
196+
return True
197+
return self.new_direction
198+
199+
190200
def run_step(self, gradient, kl_new):
191201
"""
192202
Perform the minimization step with the line minimization

Modules/SchaMinimizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,8 +1403,8 @@ def check_stop(self):
14031403

14041404
# Check the KL
14051405
kl = self.ensemble.get_effective_sample_size()
1406-
1407-
if kl / float(self.ensemble.N) < self.kong_liu_ratio and self.minimizer.new_direction:
1406+
1407+
if kl / float(self.ensemble.N) < self.kong_liu_ratio and self.minimizer.is_new_direction():
14081408
self.__converged__ = False
14091409
print ("KL:", kl, "KL/N:", kl / float(self.ensemble.N), "KL RAT:", self.kong_liu_ratio)
14101410
print (" According to your input criteria")

0 commit comments

Comments
 (0)