Skip to content

Commit

Permalink
Merge pull request #273 from nlesc-nano/err
Browse files Browse the repository at this point in the history
BUG: Fix only settings not being properly updated for PES-averaged ARMC
  • Loading branch information
BvB93 authored Mar 21, 2022
2 parents f7b2ed0 + 83f15a3 commit 945b453
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions FOX/armc/armc.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def do_inner(self, kappa: int, omega: int, acceptance: np.ndarray, key_old: Key)
"""
# Step 1: Perform a random move
_key_new = self._do_inner1(key_old)
_key_new = self._do_inner1(key_old, idx=None)

# Step 2: Calculate PES descriptors
pes_new, pes_validation, mol_list = self._do_inner2()
Expand All @@ -276,17 +276,17 @@ def do_inner(self, kappa: int, omega: int, acceptance: np.ndarray, key_old: Key)
pes_new, pes_validation, kappa, omega)
return key_new

def _do_inner1(self, key_old: Key, idx: int = 0) -> Key:
def _do_inner1(self, key_old: Key, idx: None | int) -> Key:
"""Perform a random move."""
key_new = self.move(idx=idx)

if isinstance(key_new, Exception):
self.logger.warning(f"Recalculating move; {key_new}")
return self._do_inner1(key_old)
return self._do_inner1(key_old, idx=idx)

elif key_new in self:
self.logger.info("Recalculating move; move has already been visited")
return self._do_inner1(key_old)
return self._do_inner1(key_old, idx=idx)

return key_new

Expand Down
2 changes: 1 addition & 1 deletion FOX/armc/armc_pt.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def do_inner(self, kappa: int, omega: int, acceptance: np.ndarray,
"""
# Step 1: Perform a random move
_key_new = [self._do_inner1(key, i) for i, key in enumerate(key_old)]
_key_new = [self._do_inner1(key, idx=i) for i, key in enumerate(key_old)]

# Step 2: Calculate PES descriptors
pes_new, pes_validation, mol_list = self._do_inner2()
Expand Down

0 comments on commit 945b453

Please # to comment.