Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifications to subfrctor activation #193

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions geometric/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,8 @@ def evaluateStep(self):
# 2020-03-10: Step quality thresholds are hard-coded here.
colors = {}
if Quality > 0.75: step_state = StepState.Good
elif Quality > (0.5 if params.transition else 0.25): step_state = StepState.Okay
elif Converged_energy or (Quality > (0.5 if params.transition else 0.25)):
step_state = StepState.Okay
elif Quality > 0.0: step_state = StepState.Poor
else:
colors['energy'] = "\x1b[92m" if Converged_energy else "\x1b[91m"
Expand Down Expand Up @@ -634,6 +635,13 @@ def evaluateStep(self):
# if step_state in (StepState.Okay, StepState.Poor, StepState.Reject) and params.transition:
# logger.info("LPW: Recalculating Hessian\n")
# self.recalcHess = True
def activate_subfrctor():
if self.params.subfrctor == 1 and ((rms_displacement_noalign / rms_displacement) > self.lowq_tr_thre):
self.lowq_tr_count += 1
if self.lowq_tr_count == self.lowq_tr_limit :
logger.info("Poor-quality step dominated by net translation/rotation detected; ")
logger.info("will project out net forces and torques past this point.\n")

if step_state in (StepState.Poor, StepState.Reject):
new_trust = max(params.tmin, min(self.trust, self.cnorm)/2)
# if (Converged_grms or Converged_gmax) or (params.molcnv and Converged_molpro_gmax):
Expand All @@ -642,17 +650,14 @@ def evaluateStep(self):
self.trust = new_trust
# A poor quality step that is dominated by overall translation/rotation
# is a sign that projecting out the net force and torque may be needed
if self.params.subfrctor == 1 and ((rms_displacement_noalign / rms_displacement) > self.lowq_tr_thre):
self.lowq_tr_count += 1
if self.lowq_tr_count == self.lowq_tr_limit :
logger.info("Poor-quality step dominated by net translation/rotation detected; ")
logger.info("will project out net forces and torques past this point.\n")
activate_subfrctor()
elif step_state == StepState.Good:
new_trust = min(params.tmax, np.sqrt(2)*self.trust)
self.trustprint = "\x1b[92m+\x1b[0m" if new_trust > self.trust else "="
self.trust = new_trust
elif step_state == StepState.Okay:
self.trustprint = "="
if (Quality < (0.5 if params.transition else 0.25)): activate_subfrctor()

if step_state == StepState.Reject:
if hasattr(self, 'X_rj') and np.allclose(self.X_rj, self.X, atol=1e-6):
Expand Down
Loading