libAtoms / QUIP

libAtoms/QUIP molecular dynamics framework: https://libatoms.github.io
351 stars 121 forks source link

low level problem comparing atom structures in quippy #69

Closed noambernstein closed 5 years ago

noambernstein commented 7 years ago

I'm not sure how this happens or exactly how to reproduce it yet except by running a moderately expensive CASTEP_ASE bulk Si test, but I can get a crash in oo_fortran.py line 449 in FortranDerivedType.__eq__. Specifically, in that line getattr(self, el) is compared to getattr(other, el), but sometimes (e.g. cutoff in my case) other doesn't have the element that self has. Since the loop over el comes from the elements of self, I suggest adding another "if" right before, something like

if not hasattr(other, el):
   wraplog.debug('element in self but not other %s' % el)
   return False
jameskermode commented 7 years ago

Should now be fixed, let me know if it solves the underlying problem.

gabor1 commented 5 years ago

Can we close this?

bernstei commented 5 years ago

yes