Skip to content

Commit

Permalink
fix AtomsBatch save structures bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaochendu committed Dec 13, 2023
1 parent bc29b9e commit b50975d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mcmc/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def slab_energy(slab, relax=False, update_neighbors=True, **kwargs):
energy = ENERGY_THRESHOLD
# energy = np.sign(energy) * UNRELAXED_ENERGY_THRESHOLD

return energy, energy_std, max_force, force_std
return energy, energy_std, max_force, force_std, 0.0

logger.debug(f"performing relaxation")
slab, energy = optimize_slab(slab, **kwargs)
Expand Down
6 changes: 5 additions & 1 deletion mcmc/mcmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,14 +441,18 @@ def save_structures(self, i: int = 0, **kwargs):
energy_std = 0
force_std = 0
else:
energy, energy_std, _, force_std, _ = slab_energy(
results = slab_energy(
self.slab,
relax=self.relax,
folder_name=self.run_folder,
iter=i + 1,
save=True,
**self.kwargs,
)
energy = results[0]
energy_std = results[1]
force_std = results[3]

if type(self.slab) is AtomsBatch:
logger.info(
f"current energy is {self.curr_energy}, calculated energy is {energy}"
Expand Down

0 comments on commit b50975d

Please sign in to comment.