Skip to content

Commit

Permalink
Use potential_expression in hash for AtomType (#528)
Browse files Browse the repository at this point in the history
* Use potential_expression in hash for AtomType

* WIP- Fix import order in test_atom_type.py
  • Loading branch information
umesh-timalsina authored Apr 8, 2021
1 parent 82403fd commit 8264258
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 1 addition & 4 deletions gmso/core/atom_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,7 @@ def __hash__(self):
self.name,
unyt_to_hashable(self.mass),
unyt_to_hashable(self.charge),
self.expression,
tuple(self.independent_variables),
tuple(self.parameters.keys()),
tuple(unyt_to_hashable(val) for val in self.parameters.values())
self.potential_expression
)
)
)
Expand Down
5 changes: 5 additions & 0 deletions gmso/tests/test_atom_type.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from copy import deepcopy
import unyt as u
import sympy
import pytest
Expand Down Expand Up @@ -216,3 +217,7 @@ def test_with_1000_atom_types(self):
assert len(top.atom_types) == 1
assert top.n_sites == 1000

def test_atom_type_copy(self, typed_ethane):
for atom_type in typed_ethane.atom_types:
assert atom_type.copy(deep=True) == atom_type
assert deepcopy(atom_type) == atom_type

0 comments on commit 8264258

Please sign in to comment.