Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/mosdef-hub/gmso into write_…
Browse files Browse the repository at this point in the history
…charge_in_elementary
  • Loading branch information
daico007 committed Dec 20, 2023
2 parents c340117 + 51d8905 commit e86a6c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion gmso/abc/serialization_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
import numpy as np
import unyt as u

from gmso.utils.units import GMSO_UnitRegistry

__all__ = ["unyt_to_dict", "dict_to_unyt", "GMSOJSONHandler"]

uregistry = GMSO_UnitRegistry()


def unyt_to_dict(unyt_qt: Union[u.unyt_array, u.unyt_quantity]) -> dict:
"""Convert a unyt quantity into json serializable dictionary"""
Expand All @@ -32,4 +36,6 @@ def dict_to_unyt(dict_obj) -> None:
else:
unyt_func = u.unyt_array

dict_obj[key] = unyt_func(np_array, value["unit"])
dict_obj[key] = unyt_func(
np_array, value["unit"], registry=uregistry.reg
)
1 change: 1 addition & 0 deletions gmso/formats/lammpsdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ def _get_connection(filename, topology, base_unyts, connection_type):
site_list.append(site)
ctype = copy.copy(connection_type_list[int(line.split()[1]) - 1])
ctype.member_types = tuple(map(lambda x: x.atom_type.name, site_list))
ctype.member_classes = ctype.member_types
if connection_type == "bond":
connection = Bond(
connection_members=site_list,
Expand Down

0 comments on commit e86a6c5

Please sign in to comment.