Skip to content

Commit

Permalink
Added extra messages to UIatoms class for debugging GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
elinscott committed Oct 11, 2024
1 parent 56d88c0 commit 9553fcf
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/koopmans/processes/ui/_atoms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from ase import Atoms
from ase.cell import Cell

from koopmans import utils


class UIAtoms(Atoms):

Expand Down Expand Up @@ -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

0 comments on commit 9553fcf

Please sign in to comment.