Skip to content

Commit

Permalink
remove fix to delete large files
Browse files Browse the repository at this point in the history
  • Loading branch information
shinkle-lanl committed Sep 16, 2024
1 parent 39b7bb2 commit 0805ce2
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions hippynn/molecular_dynamics/md.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations
from functools import singledispatchmethod
from copy import copy

import numpy as np
import torch
Expand All @@ -9,7 +10,6 @@
from ..graphs import Predictor
from ..layers.pairs.periodic import wrap_systems_torch


class Variable:
"""
Tracks the state of a quantity (eg. position, cell, species,
Expand Down Expand Up @@ -307,10 +307,12 @@ def pre_step(self, dt):

self.variable.data["position"] = self.variable.data["position"] + self.variable.data["velocity"] * dt

try:
_, self.variable.data["position"], *_ = wrap_systems_torch(coords=self.variable.data["position"], cell=self.variable.data["cell"], cutoff=0) # cutoff only used for discarded outputs; can be set arbitrarily
except KeyError:
pass
if "cell" in self.variable.data.keys():
_, self.variable.data["position"], *_ = wrap_systems_torch(coords=self.variable.data["position"], cell=self.variable.data["cell"], cutoff=0) # cutoff only impacts unused outputs; can be set arbitrarily
try:
self.variable.data["unwrapped_position"] = self.variable.data["unwrapped_position"] + self.variable.data["velocity"] * dt
except KeyError:
self.variable.data["unwrapped_position"] = copy(self.variable.data["position"])

def post_step(self, dt, model_outputs):
"""Updates to variables performed during each step of MD simulation after HIPNN model evaluation
Expand Down Expand Up @@ -406,6 +408,7 @@ def model(self, model):
+ f" Entries in the 'model_input_map' should have the form 'hipnn-db_name: variable-data-key' where 'hipnn-db_name'"
+ f" refers to the db_name of an input for the hippynn Predictor model,"
+ f" and 'variable-data-key' corresponds to a key in the 'data' dictionary of one of the Variables."
+ f" Currently assigned db_names are: {variable_data_db_names}."
)
self._model = model

Expand Down Expand Up @@ -482,6 +485,9 @@ def _update_data(self, model_outputs: dict):
except KeyError:
self._data[f"output_{key}"] = [value.cpu().detach()[0]]

for key, value in variable._data.items():
print(variable.name, key, value.shape)


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

0 comments on commit 0805ce2

Please sign in to comment.