File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -397,18 +397,23 @@ def check_coupling_coeffs(self, coupling_file):
397397 )
398398 element_list = [e .strip () for e in element_list ]
399399
400- # We cannot compare the lists as sets, because order is
401- # important.
402- # We omit "G" from the comparison, because it is not an
403- # element. It does have to be in the list for the coupling
404- # constants though.
405- if (
406- sorted (list (set (self ._atoms .symbols ))) != element_list [:- 1 ]
407- or element_list [- 1 ] != "G"
408- ):
409- return None
410- else :
400+ # We don't have to worry about order in this comparison,
401+ # because both lists are ordered, and the element lists
402+ # in the coupling coefficients are always saved in an
403+ # ordered fashion.
404+ compatible = True
405+ if element_list [- 1 ] != "G" :
406+ compatible = False
407+ list_ase = sorted (list (set (self ._atoms .symbols )))
408+ for element_idx in range (len (list_ase )):
409+ if list_ase [element_idx ] not in element_list :
410+ compatible = False
411+ break
412+
413+ if compatible :
411414 return coupling_file
415+ else :
416+ return None
412417 else :
413418 return None
414419
You can’t perform that action at this time.
0 commit comments