def onEEC(self, event): atom = self.tc2.GetValue() orbital = self.tc3.GetValue() data = cas.open_file(self.tc0.GetValue()) start, end, nel, norb = cas.get_active(data) LCO = cas.get_LCO(data) comp = cas.get_spec_orb(LCO, self.tc2.GetValue(), self.tc3.GetValue().lower(), Decimal('0.1')) orb_dict = cas.create_OrbDict(LCO) eec = 0 active_eec = 0 ordered = {} for k in comp.iterkeys(): ordered[int(k)] = comp[k] ordered = sorted(ordered, key=lambda key: key) for orbital in ordered: percentage = comp[str(orbital)][0][1] occupation = orb_dict[str(orbital)][1] eec += Decimal(percentage) * Decimal(occupation) if orbital in range(int(start), int(end) + 1): active_eec += Decimal(percentage) * Decimal(occupation) eec = round(eec / 100, 2) active_eec = round(active_eec / 100, 2) int_eec = eec - active_eec message = 'The effective electron count (EEC) is: %s\nThe internal EEC is: %s\nThe active EEC is: %s' % ( str(eec), str(int_eec), str(active_eec)) wx.MessageBox(message, 'Info', wx.OK | wx.ICON_INFORMATION)
def onEEC(self, event): atom = self.tc2.GetValue() orbital = self.tc3.GetValue() data = cas.open_file(self.tc0.GetValue()) start, end, nel, norb = cas.get_active(data) LCO = cas.get_LCO(data) comp = cas.get_spec_orb(LCO,self.tc2.GetValue(),self.tc3.GetValue().lower(),Decimal('0.1')) orb_dict = cas.create_OrbDict(LCO) eec = 0 active_eec = 0 ordered = {} for k in comp.iterkeys(): ordered[int(k)] = comp[k] ordered = sorted(ordered,key=lambda key: key) for orbital in ordered: percentage = comp[str(orbital)][0][1] occupation = orb_dict[str(orbital)][1] eec += Decimal(percentage) * Decimal(occupation) if orbital in range(int(start),int(end)+1): active_eec += Decimal(percentage) * Decimal(occupation) eec = round(eec/100,2) active_eec = round(active_eec/100,2) int_eec = eec-active_eec message = 'The effective electron count (EEC) is: %s\nThe internal EEC is: %s\nThe active EEC is: %s' %(str(eec),str(int_eec),str(active_eec)) wx.MessageBox(message, 'Info', wx.OK | wx.ICON_INFORMATION)
def onComp(self, event): self.lc.DeleteAllItems() num_items = self.lc.GetItemCount() if self.lc.GetColumnCount() == 3: self.lc.DeleteColumn(2) self.lc.DeleteColumn(0) self.lc.InsertColumn(0, 'Orbital') self.lc.DeleteColumn(1) self.lc.InsertColumn(1, 'Orbital Type') self.lc.InsertColumn(2, 'Percentage') self.lc.SetColumnWidth(0, 95) self.lc.SetColumnWidth(1, 95) self.lc.SetColumnWidth(2, 95) data = cas.open_file(self.tc0.GetValue()) self.threshold = Decimal(self.tc1.GetValue()) self.rangestart = self.rangestart_tc.GetValue() self.rangeend = self.rangeend_tc.GetValue() LCO = cas.get_LCO(data) if self.tc2.GetValue() == '' and self.tc3.GetValue( ) == '' and self.rangestart == '' and self.rangeend == '': comp = cas.get_d_orbitals(LCO, self.threshold) elif self.rangestart != '' and self.rangeend != '': if isinstance(int(self.rangestart), int) and isinstance( int(self.rangeend), int): self.lc.DeleteAllItems() if self.lc.GetColumnCount() == 3: self.lc.DeleteColumn(2) self.lc.DeleteColumn(1) self.lc.DeleteColumn(0) self.lc.InsertColumn(0, 'Orbital') self.lc.InsertColumn(1, 'Occupation Number') self.lc.SetColumnWidth(0, 115) self.lc.SetColumnWidth(1, 140) data = cas.open_file(self.tc0.GetValue()) num_items = self.lc.GetItemCount() LCO = cas.get_LCO(data) orb_dict = cas.create_OrbDict(LCO) for orbital in range(int(self.rangestart), int(self.rangeend) + 1): self.lc.InsertStringItem(num_items, str(orbital)) self.lc.SetStringItem(num_items, 1, orb_dict[str(orbital)][1]) num_items += 1 else: comp = cas.get_spec_orb(LCO, self.tc2.GetValue(), self.tc3.GetValue().lower(), self.threshold) ordered = {} if self.rangestart == '' and self.rangeend == '': for k in comp.iterkeys(): ordered[int(k)] = comp[k] ordered = sorted(ordered, key=lambda key: key) for number in ordered: orbitals = comp[str(number)] for orb in orbitals: self.lc.InsertStringItem(num_items, str(number)) self.lc.SetStringItem(num_items, 1, orb[0]) self.lc.SetStringItem(num_items, 2, orb[1]) num_items += 1
def onComp(self,event): self.lc.DeleteAllItems() num_items = self.lc.GetItemCount() if self.lc.GetColumnCount() == 3: self.lc.DeleteColumn(2) self.lc.DeleteColumn(0) self.lc.InsertColumn(0,'Orbital') self.lc.DeleteColumn(1) self.lc.InsertColumn(1,'Orbital Type') self.lc.InsertColumn(2,'Percentage') self.lc.SetColumnWidth(0, 95) self.lc.SetColumnWidth(1, 95) self.lc.SetColumnWidth(2, 95) data = cas.open_file(self.tc0.GetValue()) self.threshold = Decimal(self.tc1.GetValue()) self.rangestart = self.rangestart_tc.GetValue() self.rangeend = self.rangeend_tc.GetValue() LCO = cas.get_LCO(data) if self.tc2.GetValue() == '' and self.tc3.GetValue() == '' and self.rangestart == '' and self.rangeend == '': comp = cas.get_d_orbitals(LCO,self.threshold) elif self.rangestart != '' and self.rangeend != '': if isinstance(int(self.rangestart),int) and isinstance(int(self.rangeend),int): self.lc.DeleteAllItems() if self.lc.GetColumnCount() == 3: self.lc.DeleteColumn(2) self.lc.DeleteColumn(1) self.lc.DeleteColumn(0) self.lc.InsertColumn(0,'Orbital') self.lc.InsertColumn(1,'Occupation Number') self.lc.SetColumnWidth(0, 115) self.lc.SetColumnWidth(1, 140) data = cas.open_file(self.tc0.GetValue()) num_items = self.lc.GetItemCount() LCO = cas.get_LCO(data) orb_dict = cas.create_OrbDict(LCO) for orbital in range(int(self.rangestart),int(self.rangeend)+1): self.lc.InsertStringItem(num_items, str(orbital)) self.lc.SetStringItem(num_items,1,orb_dict[str(orbital)][1]) num_items += 1 else: comp = cas.get_spec_orb(LCO,self.tc2.GetValue(),self.tc3.GetValue().lower(),self.threshold) ordered = {} if self.rangestart == '' and self.rangeend == '': for k in comp.iterkeys(): ordered[int(k)] = comp[k] ordered = sorted(ordered,key=lambda key: key) for number in ordered: orbitals = comp[str(number)] for orb in orbitals: self.lc.InsertStringItem(num_items,str(number)) self.lc.SetStringItem(num_items,1,orb[0]) self.lc.SetStringItem(num_items,2,orb[1]) num_items += 1