anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: mosdef-hub/gmso
Issue: Change __hash__ method in CoreTypes to reflect ForceField class changes

With #186, merged, the hashing needs some changes vis-à-vis parameters and how the hash
 is calculated. 

Changed files:
topology/utils/misc.py, topology/tests/test_forcefield_xml.py

diff --git a/topology/tests/test_forcefield_xml.py b/topology/tests/test_forcefield_xml.py
index a7a0ead..68c88e5 100644
--- a/topology/tests/test_forcefield_xml.py
+++ b/topology/tests/test_forcefield_xml.py
@@ -95,8 +95,15 @@ class TestForceFieldFromXML(BaseTest):
     def test_ff_charmm_xml(self, charm_ff):
         assert charm_ff.name == 'topologyCharmm'
         assert "*~CS~SS~*" in charm_ff.dihedral_types
-        # Test Correct Parameters
+
+        # Test list of parameters
         assert isinstance(charm_ff.dihedral_types["*~CE1~CE1~*"].parameters['k'], list)
+
+        # This ensures that even though the parameters is a list, they can be hashed (by equality checks)
+        assert charm_ff.dihedral_types["*~CE1~CE1~*"] == charm_ff.dihedral_types["*~CE1~CE1~*"]
         assert len(charm_ff.dihedral_types["*~CE1~CE1~*"].parameters['k']) == 2
+
+        # Test Correct Parameter Values
         assert charm_ff.dihedral_types["*~CE1~CE1~*"].parameters['k'] == \\
-               [u.unyt_quantity(0.6276, u.kJ), u.unyt_quantity(35.564, u.kJ)]
\\ No newline at end of file
+               [u.unyt_quantity(0.6276, u.kJ), u.unyt_quantity(35.564, u.kJ)]
+
diff --git a/topology/utils/misc.py b/topology/utils/misc.py
index 87445b2..21b8c92 100644
--- a/topology/utils/misc.py
+++ b/topology/utils/misc.py
@@ -1,13 +1,24 @@
 import unyt as u
 
 
-def unyt_to_hashable(val):
-    """Convert a unyt array or quantity to a hashable tuple."""
-    if val is None:
-        return val
-    # TODO: More elegantly handle hashing charges, see #123
+def unyt_to_hashable(unyt_or_unyt_iter):
+    """Convert a (list of) unyt array or quantity to a hashable tuple."""
+    if unyt_or_unyt_iter is None:
+        return unyt_or_unyt_iter
+    hash_coll = []
+    if isinstance(unyt_or_unyt_iter, list):
+        for val in unyt_or_unyt_iter:
+            hash_coll.append(_unyt_to_hashable_single(val))
+        return tuple(hash_coll)
+    else:
+        return _unyt_to_hashable_single(unyt_or_unyt_iter)
+
+
+def _unyt_to_hashable_single(val):
     if isinstance(val, u.unyt_quantity):
         if val.units == u.elementary_charge and u.value == 0:
             val.convert_to_units(u.coulomb)
         val = u.unyt_array(val.reshape(-1))
-    return tuple(val.in_base().value)
+        return tuple(val.in_base().value)
+    else:
+        return None
Repository: mosdef-hub/gmso
Issue: Convert mBuild boxes to numpy arrays 

With https://github.com/mosdef-hub/mbuild/pull/672, some tests in [test_convert_mbuild.py](https://github.com/mattwthompson/topology/blob/master/topology/tests/test_convert_mbuild.py) are not passing and give the error message: 
```python
unyt.exceptions.InvalidUnitOperation: Tried to multiply a Unit object with '[0.22807001 0.20428    0.18468   ]' (type <class 'mbuild.box._BoxArray'>). This behavior is undefined.
```
I think this because mbuild.Box attributes are type `BoxArray` instead of `ndarray` and `unyt` doesn't recognize `BoxArray`s. 


Probably the easiest fix would be to cast the BoxArray as an numpy ndarray before we apply units. In this line for example:
https://github.com/mattwthompson/topology/blob/91e527bf5b9da516cb0788247070f58757927f5f/topology/external/convert_mbuild.py#L87


Changed files:
topology/external/convert_mbuild.py

diff --git a/topology/external/convert_mbuild.py b/topology/external/convert_mbuild.py
index 6437836..e30e8ed 100644
--- a/topology/external/convert_mbuild.py
+++ b/topology/external/convert_mbuild.py
@@ -142,8 +142,8 @@ def from_mbuild_box(mb_box):
         return None
 
     box = Box(
-        lengths=mb_box.lengths*u.nm,
-        angles=mb_box.angles*u.degree,
+        lengths=np.asarray(mb_box.lengths)*u.nm,
+        angles=np.asarray(mb_box.angles)*u.degree,
     )
 
     return box