Skip to content
Open
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
9 changes: 8 additions & 1 deletion simulariumio/nerdss/nerdss_converter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from MDAnalysis import Universe
import os

import numpy as np

from ..trajectory_converter import TrajectoryConverter
from ..data_objects import (
AgentData,
Expand Down Expand Up @@ -131,6 +133,10 @@ def _read_pdb_files(self, input_data: NerdssData) -> AgentData:
"bonds", input_data.display_data
)
next_uid = agent_data.unique_ids.max() + 1

# need our own write-able n_subpoints array
n_subpoints = np.zeros_like(agent_data.n_subpoints)

for timestep in range(n_timesteps):
n_fibers = len(fiber_positions[timestep])
n_atoms = int(agent_data.n_agents[timestep])
Expand All @@ -139,7 +145,7 @@ def _read_pdb_files(self, input_data: NerdssData) -> AgentData:
agent_data.subpoints[timestep][agent_index + n_atoms] = fiber_positions[
timestep
][agent_index]
agent_data.n_subpoints[timestep][agent_index + n_atoms] = (
n_subpoints[timestep][agent_index + n_atoms] = (
VALUES_PER_3D_POINT * 2
)
agent_data.viz_types[timestep][agent_index + n_atoms] = VIZ_TYPE.FIBER
Expand All @@ -149,6 +155,7 @@ def _read_pdb_files(self, input_data: NerdssData) -> AgentData:
agent_data.types[timestep].append(bonds_display_data.name)
agent_data.unique_ids[timestep][agent_index + n_atoms] = next_uid
next_uid += 1
agent_data.n_subpoints = n_subpoints # overwrite with our own array
return agent_data

def _read(self, input_data: NerdssData) -> TrajectoryData:
Expand Down