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

fix bug with saving batched MD results #109

Merged
merged 1 commit into from
Oct 17, 2024
Merged
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
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
Loading