Skip to content

Commit fe90992

Browse files
committed
Fixed the error on the step
1 parent 0164212 commit fe90992

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
@@ -1426,8 +1426,8 @@ def check_stop(self):
14261426

14271427
# Check the KL
14281428
kl = self.ensemble.get_effective_sample_size()
1429-
1430-
if kl / float(self.ensemble.N) < self.kong_liu_ratio and self.minimizer.new_direction:
1429+
1430+
if kl / float(self.ensemble.N) < self.kong_liu_ratio and self.minimizer.is_new_direction():
14311431
self.__converged__ = False
14321432
print ("KL:", kl, "KL/N:", kl / float(self.ensemble.N), "KL RAT:", self.kong_liu_ratio)
14331433
print (" According to your input criteria")

0 commit comments

Comments
 (0)