Skip to content

Commit f301a48

Browse files
committed
MAINT: Update neighbor list before NFF energy calls
1 parent e18a54b commit f301a48

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

mcmc/calculators/calculators.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,10 @@ def calculate(
353353
if atoms is None:
354354
atoms = self.atoms
355355

356+
if hasattr(atoms, "update_nbr_list"):
357+
# MCMC may add/remove atoms, so update neighbor list
358+
atoms.update_nbr_list(update_atoms=True)
359+
356360
NeuralFF.calculate(self, atoms, properties, system_changes)
357361

358362
if "surface_energy" in properties:
@@ -481,6 +485,10 @@ def calculate(
481485
if atoms is None:
482486
atoms = self.atoms
483487

488+
if hasattr(atoms, "update_nbr_list"):
489+
# MCMC may add/remove atoms, so update neighbor list
490+
atoms.update_nbr_list(update_atoms=True)
491+
484492
EnsembleNFF.calculate(self, atoms, properties, system_changes)
485493

486494
if "surface_energy" in properties:

0 commit comments

Comments
 (0)