Skip to content

Commit

Permalink
change default mass and charge values back to None; fix handling of N…
Browse files Browse the repository at this point in the history
…one mass and charges in gsd writer
  • Loading branch information
chrisjonesBSU committed Jul 25, 2022
1 parent a537c3e commit 918425b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gmso/core/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class Atom(Site):
the gmso.abc.abstract site class
"""
charge_: Optional[Union[u.unyt_quantity, float]] = Field(
0.0,
description="Charge of the atom. Defaults to 0.0 if not set.",
None,
description="Charge of the atom.",
)

mass_: Optional[Union[u.unyt_quantity, float]] = Field(
0.0, description="Mass of the atom. Defaults to 0.0 if not set."
None, description="Mass of the atom."
)

element_: Optional[Element] = Field(
Expand Down
2 changes: 2 additions & 0 deletions gmso/formats/gsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ def _write_particle_information(

masses = np.array([site.mass for site in top.sites])
masses[masses == 0] = 1.0
masses[masses == None] = 1.0
gsd_snapshot.particles.mass = masses / ref_mass

charges = np.array([site.charge for site in top.sites])
charges[charges == None] = 0.0
e0 = u.physical_constants.eps_0.in_units(
u.elementary_charge**2 / u.Unit("kcal*angstrom/mol")
)
Expand Down

0 comments on commit 918425b

Please sign in to comment.