From 9553fcf8bd9b6361e8949d6840b2f59b5fbed2e8 Mon Sep 17 00:00:00 2001 From: Edward Linscott Date: Fri, 11 Oct 2024 15:38:06 +0200 Subject: [PATCH] Added extra messages to UIatoms class for debugging GH action --- src/koopmans/processes/ui/_atoms.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/koopmans/processes/ui/_atoms.py b/src/koopmans/processes/ui/_atoms.py index 8e98b4234..210b703f7 100644 --- a/src/koopmans/processes/ui/_atoms.py +++ b/src/koopmans/processes/ui/_atoms.py @@ -13,6 +13,8 @@ from ase import Atoms from ase.cell import Cell +from koopmans import utils + class UIAtoms(Atoms): @@ -79,3 +81,26 @@ def fromatoms(cls, atoms: Atoms, supercell_matrix: Optional[np.ndarray] = None): # Return the new UIAtoms object return ui_atoms + + def __eq__(self, other): + # Patching for test + if not isinstance(other, UIAtoms): + return False + a = self.arrays + b = other.arrays + if len(self) != len(other): + utils.warn('Atoms have different lengths') + return False + if (a['numbers'] != b['numbers']).any(): + utils.warn('Atoms have different numbers') + return False + if (a['positions'] != b['positions']).any(): + utils.warn('Atoms have different positions') + return False + if not (self.cell == other.cell).all(): + utils.warn('Atoms have different cells') + return False + if not (self.pbc == other.pbc).all(): + utils.warn('Atoms have different pbc') + return False + return True