From 525950560bf82ef2ff139c7eac32bcc513d881e7 Mon Sep 17 00:00:00 2001 From: Logan Ward Date: Thu, 9 Aug 2018 17:18:11 -0500 Subject: [PATCH] Added shortcut for determining if structures are equal --- pymatgen/core/structure.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pymatgen/core/structure.py b/pymatgen/core/structure.py index 080b17b69f7..031c630c4d5 100644 --- a/pymatgen/core/structure.py +++ b/pymatgen/core/structure.py @@ -722,6 +722,8 @@ def matches(self, other, **kwargs): return m.fit(Structure.from_sites(self), Structure.from_sites(other)) def __eq__(self, other): + if other is self: + return True if other is None: return False if len(self) != len(other):