Skip to content

Commit

Permalink
add if statement before writing rigid tags
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjonesBSU committed Sep 23, 2024
1 parent f6480bc commit ad603fa
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions gmso/external/convert_hoomd.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ def _parse_particle_information(
n_rigid = 0
unique_types = sorted(list(set(types)))
typeids = np.array([unique_types.index(t) for t in types])
rigid_id_tags = None
if write_rigid:
rigid_masses = np.zeros(n_rigid)
rigid_xyz = np.zeros(n_rigid)
Expand Down Expand Up @@ -347,15 +346,17 @@ def _parse_particle_information(
snapshot.particles.typeid[0:] = typeids
snapshot.particles.mass[0:] = masses
snapshot.particles.charge[0:] = charges / charge_factor
snapshot.particles.body = rigid_id_tags
if write_rigid:
snapshot.particles.body[0:] = rigid_id_tags
elif isinstance(snapshot, gsd.hoomd.Frame):
snapshot.particles.N = top.n_sites
snapshot.particles.types = unique_types
snapshot.particles.position = xyz
snapshot.particles.typeid = typeids
snapshot.particles.mass = masses
snapshot.particles.charge = charges / charge_factor
snapshot.particles.body = rigid_id_tags
if write_rigid:
snapshot.particles.body = rigid_id_tags


def _parse_pairs_information(
Expand Down

0 comments on commit ad603fa

Please sign in to comment.