Skip to content

Commit

Permalink
handles missing velocity, still need to interpolate values
Browse files Browse the repository at this point in the history
  • Loading branch information
BradyAJohnston committed Nov 25, 2024
1 parent 4d0b001 commit 7223bf7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions molecularnodes/entities/trajectory/dna.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ def _update_positions(self, frame: int) -> None:

def _update_timestep_values(self):
for name in self._att_names:
self.store_named_attribute(
self.universe.trajectory.ts.data[name] * self.world_scale, name=name
)
try:
self.store_named_attribute(
self.universe.trajectory.ts.data[name] * self.world_scale, name=name
)
except KeyError:
pass


def load(top, traj, name="oxDNA", setup_nodes=True, world_scale=0.01):
Expand Down
5 changes: 4 additions & 1 deletion molecularnodes/entities/trajectory/oxdna/OXDNAReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ def _read_frame(self, frame):
for i, name in enumerate(
("base_vector", "base_normal", "velocity", "angular_velocity")
):
cols = np.arange(3) + 3 * (i + 1)
starting_column = 3 * (i + 1)
if starting_column >= array.shape[1]:
continue
cols = np.arange(3) + starting_column
self.ts.data[name] = array[:, cols]
self.ts.frame = frame

Expand Down

0 comments on commit 7223bf7

Please sign in to comment.