Skip to content

Commit

Permalink
fix bug with saving batched MD results (lanl#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
shinkle-lanl authored Oct 17, 2024
1 parent c330ddf commit 10bded4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hippynn/molecular_dynamics/md.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,14 +458,14 @@ def _update_data(self, model_outputs: dict):
for variable in self.variables:
for key, value in variable.data.items():
try:
self._data[f"{variable.name}_{key}"].append(value.cpu().detach()[0])
self._data[f"{variable.name}_{key}"].append(value.cpu().detach())
except KeyError:
self._data[f"{variable.name}_{key}"] = [value.cpu().detach()[0]]
self._data[f"{variable.name}_{key}"] = [value.cpu().detach()]
for key, value in model_outputs.items():
try:
self._data[f"output_{key}"].append(value.cpu().detach()[0])
self._data[f"output_{key}"].append(value.cpu().detach())
except KeyError:
self._data[f"output_{key}"] = [value.cpu().detach()[0]]
self._data[f"output_{key}"] = [value.cpu().detach()]

def run(self, dt: float, n_steps: int, record_every: Optional[int] = None):
"""Run `n_steps` of MD algorithm.
Expand Down

0 comments on commit 10bded4

Please sign in to comment.