def __init__(self, qid): assert type(qid) is str, "Need String input" these = qid.split() assert len(these) > 0, "No QuantumIdentifier" spec = these[0].split('-') # UGLY: What about negative charge? if len(spec) == 1: self._afgl = None if spec[0] == 'None': self._spec = None else: self._spec = spec[0] elif len(spec) == 2: self._spec = spec[0] self._afgl = int(spec[1]) else: assert False, "Cannot recognize species" if len(these) == 1: self._transition = False self._level = False return if these[1] == 'TR': self._transition = True self._level = False elif these[1] == 'EN': self._transition = False self._level = True else: assert False, "Must be energy level [EN] or transition [TR] type" self._qns = as_quantumnumbers(" ".join(these[2:])) self._assert_sanity_()
def __ge__(self, qns): if type(qns) is QuantumNumberRecord: return self['LO'] >= qns['LO'] and self['UP'] >= qns['UP'] elif type(qns) is QuantumNumbers: return self['UP'] >= qns, self['LO'] >= qns else: return self >= as_quantumnumbers(qns)
def qns(self, qns): self._qns = as_quantumnumbers(qns) if type(self._qns) is QuantumNumberRecord: self._transition = True self._level = False elif type(self._qns) is QuantumNumbers: self._transition = False self._level = True else: assert False, "Programmer error?"
def __setitem__(self, key, value): self._qns[key] = return_if_arts_type(as_quantumnumbers(value), 'QuantumNumbers')