Skip to content

Commit

Permalink
move rigid_id property to abstract_site from atom, write out rigid_id…
Browse files Browse the repository at this point in the history
… in to_mbuild
  • Loading branch information
chrisjonesBSU committed Sep 17, 2024
1 parent 3a27d99 commit bbb65c3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
11 changes: 11 additions & 0 deletions gmso/abc/abstract_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ class Site(GMSOBase):
alias="position",
)

rigid_id_: Optional[int] = Field(
None,
description="Rigid body ID used to assign rigid body contraints in HOOMD-Blue topologies.",
alias="rigid_id",
)

model_config = ConfigDict(
alias_to_fields={
"name": "name_",
Expand Down Expand Up @@ -250,6 +256,11 @@ def residue(self):
"""Return the residue assigned to the site."""
return self.__dict__.get("residue_")

@property
def rigid_id(self):
"""Return the rigid body ID for this atom."""
return self.__dict__.get("rigid_id_")

@field_serializer("position_")
def serialize_position(self, position_: PositionType):
return unyt_to_dict(position_)
Expand Down
11 changes: 0 additions & 11 deletions gmso/core/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ class Atom(Site):
alias="restraint",
)

rigid_id_: Optional[int] = Field(
None,
description="Rigid body ID used to assign rigid body contraints in HOOMD-Blue topologies.",
alias="rigid_id",
)

model_config = ConfigDict(
alias_to_fields=dict(
**Site.model_config["alias_to_fields"],
Expand Down Expand Up @@ -131,11 +125,6 @@ def restraint(self):
"""Return the restraint of this atom."""
return self.__dict__.get("restraint_")

@property
def rigid_id(self):
"""Return the rigid body ID for this atom."""
return self.__dict__.get("rigid_id_")

@field_serializer("charge_")
def serialize_charge(self, charge_: Union[u.unyt_quantity, None]):
if charge_ is None:
Expand Down
1 change: 1 addition & 0 deletions gmso/external/convert_mbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ def _parse_particle(particle_map, site):
charge=charge,
mass=mass,
)
particle.rigid_id = site.rigid_id
particle_map[site] = particle
return particle

Expand Down

0 comments on commit bbb65c3

Please sign in to comment.