示例#1
0
 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)
示例#2
0
 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)
示例#3
0
 def onBrowse(self, event):
     browser = wx.FileDialog(None, "Choose a file", os.getcwd(), "", "*.out", wx.OPEN)
     if browser.ShowModal() == wx.ID_OK:
         self.tc0.SetValue(browser.GetPath())
         data = cas.open_file(browser.GetPath())
         start, end, nel, norb = cas.get_active(data)
         self.nel_tc.SetValue(nel)
         self.norb_tc.SetValue(norb)
示例#4
0
 def onBrowse(self, event):
     browser = wx.FileDialog(None, "Choose a file", os.getcwd(), "",
                             "*.out", wx.OPEN)
     if browser.ShowModal() == wx.ID_OK:
         self.tc0.SetValue(browser.GetPath())
         data = cas.open_file(browser.GetPath())
         start, end, nel, norb = cas.get_active(data)
         self.nel_tc.SetValue(nel)
         self.norb_tc.SetValue(norb)
示例#5
0
 def onActive(self, event):
     self.lc.DeleteAllItems()
     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, 'Occupation Number')
     self.lc.SetColumnWidth(0, 115)
     self.lc.SetColumnWidth(1, 140)
     data = cas.open_file(self.tc0.GetValue())
     start, end, nel, norb = cas.get_active(data)
     num_items = self.lc.GetItemCount()
     LCO = cas.get_LCO(data)
     orb_dict = cas.create_OrbDict(LCO)
     for orbital in range(int(start), int(end) + 1):
         self.lc.InsertStringItem(num_items, str(orbital))
         self.lc.SetStringItem(num_items, 1, orb_dict[str(orbital)][1])
         num_items += 1
示例#6
0
 def onActive(self, event):
     self.lc.DeleteAllItems()
     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,'Occupation Number')
     self.lc.SetColumnWidth(0, 115)
     self.lc.SetColumnWidth(1, 140)
     data = cas.open_file(self.tc0.GetValue())
     start, end, nel, norb = cas.get_active(data)
     num_items = self.lc.GetItemCount()
     LCO = cas.get_LCO(data)
     orb_dict = cas.create_OrbDict(LCO)
     for orbital in range(int(start),int(end)+1):
         self.lc.InsertStringItem(num_items, str(orbital))
         self.lc.SetStringItem(num_items,1,orb_dict[str(orbital)][1])
         num_items += 1
示例#7
0
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self,
                           parent,
                           id,
                           title,
                           size=(600, 650),
                           style=wx.DEFAULT_DIALOG_STYLE)
        pnl = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        hbox3 = wx.BoxSizer(wx.HORIZONTAL)
        hbox4 = wx.BoxSizer(wx.HORIZONTAL)
        vbox1 = wx.BoxSizer(wx.VERTICAL)
        vbox2 = wx.BoxSizer(wx.VERTICAL)
        vbox3 = wx.BoxSizer(wx.VERTICAL)
        gridsizer = wx.GridSizer(rows=3, cols=2, hgap=1, vgap=5)
        self.oldcalcid_tc = wx.TextCtrl(pnl, size=(150, 20))
        self.oldcalcid_tc.SetValue(parent.getCalcID())
        self.newcalcid_tc = wx.TextCtrl(pnl, 2, size=(150, 20))
        self.newcalcid_tc.SetFocus()
        self.oldorb_tc = wx.TextCtrl(pnl, size=(75, 20))
        self.neworb_tc = wx.TextCtrl(pnl, size=(75, 20))
        self.oldpath_tc = wx.TextCtrl(pnl, size=(300, 20))
        self.newpath_tc = wx.TextCtrl(pnl, size=(300, 20))
        self.input_tc = wx.TextCtrl(pnl,
                                    size=(300, 300),
                                    style=wx.TE_MULTILINE)
        self.oldpath_tc.SetValue(parent.tc0.GetValue())
        self.basepath = '\\'.join(
            parent.tc0.GetValue().split('\\')[:-1]) + '\\'
        self.newpath_tc.SetValue(
            '\\'.join(parent.tc0.GetValue().split('\\')[:-1]) + '\\')
        self.active_lc = wx.ListCtrl(pnl, 4, style=wx.LC_REPORT)
        self.active_lc.InsertColumn(0, 'Orbital')
        self.active_lc.InsertColumn(1, 'Occupation Number')
        self.active_lc.InsertColumn(2, 'Orbital Type')
        self.active_lc.InsertColumn(3, 'Percentage')
        self.active_lc.SetColumnWidth(0, 75)
        self.active_lc.SetColumnWidth(1, 150)
        self.new_lc = wx.ListCtrl(pnl, 5, style=wx.LC_REPORT)
        self.new_lc.InsertColumn(0, 'Orbital')
        self.new_lc.InsertColumn(1, 'Orbital Type')
        self.new_lc.InsertColumn(2, 'Percentage')
        self.new_lc.SetColumnWidth(0, 75)
        self.new_lc.SetColumnWidth(1, 150)

        server_names = servers.getServerNames()
        self.computers = wx.ComboBox(pnl,
                                     choices=server_names,
                                     style=wx.CB_READONLY)
        if len(server_names) > 0:
            self.computers.SetValue(server_names[0])

        self.processors_tc = wx.TextCtrl(pnl, size=(40, 20))
        self.hours_tc = wx.TextCtrl(pnl, size=(40, 20))
        self.memory_tc = wx.TextCtrl(pnl, size=(40, 20))
        self.processors_tc.SetValue('32')
        self.hours_tc.SetValue('6')
        self.memory_tc.SetValue('64')

        gridsizer.Add(wx.StaticText(pnl, -1, "#of Processors :"), 0,
                      wx.ALIGN_RIGHT, 5)
        gridsizer.Add(self.processors_tc, 0, wx.ALIGN_LEFT)
        gridsizer.Add(wx.StaticText(pnl, -1, "#of Hours :"), 0, wx.ALIGN_RIGHT,
                      5)
        gridsizer.Add(self.hours_tc, 0, wx.ALIGN_LEFT)
        gridsizer.Add(wx.StaticText(pnl, -1, "Memory in GB :"), 0,
                      wx.ALIGN_RIGHT, 5)
        gridsizer.Add(self.memory_tc, 0, wx.ALIGN_LEFT)

        vbox1.Add(pnl, 1, wx.EXPAND | wx.ALL, 3)
        hbox1.AddMany([
            (wx.StaticText(pnl, -1,
                           'Current CalcID :'), 0, wx.ALIGN_LEFT | wx.LEFT, 5),
            (self.oldcalcid_tc, 0, wx.ALIGN_LEFT | wx.LEFT, 5),
            (wx.StaticText(pnl, -1,
                           'New CalcID :'), 0, wx.ALIGN_LEFT | wx.LEFT, 50),
            (self.newcalcid_tc, 2, wx.ALIGN_LEFT | wx.LEFT, 5)
        ])
        hbox2.AddMany([
            (self.oldpath_tc, 0, wx.ALIGN_LEFT | wx.LEFT | wx.TOP, 5),
            (self.newpath_tc, 0, wx.ALIGN_LEFT | wx.LEFT | wx.TOP, 5)
        ])
        hbox3.AddMany([(wx.StaticText(pnl, -1,
                                      'Active Orbital to Rotate Out :'), 0,
                        wx.ALIGN_LEFT | wx.LEFT, 5),
                       (self.oldorb_tc, 0, wx.ALIGN_LEFT | wx.LEFT, 5),
                       (wx.StaticText(pnl, -1, 'New Orbital to Rotate In :'),
                        0, wx.ALIGN_LEFT | wx.LEFT, 50),
                       (self.neworb_tc, 2, wx.ALIGN_LEFT | wx.LEFT, 5)])
        hbox4.AddMany([
            (wx.Button(pnl, 3,
                       'Rotate'), 0, wx.ALIGN_LEFT | wx.LEFT | wx.TOP, 5),
            (wx.Button(pnl, 6,
                       'Create Calc'), 0, wx.ALIGN_LEFT | wx.LEFT | wx.TOP, 5),
            (wx.Button(pnl, 7,
                       'Launch'), 0, wx.ALIGN_LEFT | wx.LEFT | wx.TOP, 5),
            (self.computers, 8, wx.EXPAND | wx.LEFT | wx.TOP, 5)
        ])
        vbox3.AddMany([(gridsizer, 0, wx.ALIGN_LEFT | wx.LEFT, 370),
                       (hbox4, 0, wx.ALIGN_LEFT | wx.TOP, -30),
                       (self.active_lc, 0, wx.EXPAND | wx.ALL, 3),
                       (self.new_lc, 0, wx.EXPAND | wx.ALL, 3),
                       (self.input_tc, 0, wx.EXPAND | wx.ALL, 3)])
        vbox2.Add(hbox1, 0, wx.ALIGN_LEFT | wx.TOP, 10)
        vbox2.Add(hbox2, 0, wx.ALIGN_LEFT | wx.TOP, 10)
        vbox2.Add(hbox3, 0, wx.ALIGN_LEFT | wx.TOP, 10)
        vbox2.Add(vbox3, 0, wx.ALIGN_LEFT | wx.TOP, 10)
        pnl.SetSizer(vbox2)

        data = cas.open_file(parent.tc0.GetValue())
        start, end, nel, norb = cas.get_active(data)
        old_num_items = self.active_lc.GetItemCount()
        new_num_items = self.new_lc.GetItemCount()
        LCO = cas.get_LCO(data)
        orb_dict = cas.create_OrbDict(LCO)
        comp = cas.get_d_orbitals(LCO, Decimal(parent.tc1.GetValue()))
        for orbital in range(int(start), int(end) + 1):
            self.active_lc.InsertStringItem(old_num_items, str(orbital))
            self.active_lc.SetStringItem(old_num_items, 1,
                                         orb_dict[str(orbital)][1])
            old_num_items += 1
        ordered = {}
        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.new_lc.InsertStringItem(new_num_items, str(number))
                self.new_lc.SetStringItem(new_num_items, 1, orb[0])
                self.new_lc.SetStringItem(new_num_items, 2, orb[1])
                new_num_items += 1

        self.newcalcid_tc.Bind(wx.EVT_TEXT, self.onNewCalcID, id=2)
        self.Bind(wx.EVT_BUTTON, self.onRotateEvent, id=3)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onOldOrb, id=4)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onNewOrb, id=5)
        self.Bind(wx.EVT_BUTTON, self.onCreateCalcEvent, id=6)
        self.Bind(wx.EVT_BUTTON, self.onLaunch, id=7)
示例#8
0
    def __init__(self,parent, id, title):
        wx.Dialog.__init__(self,parent,id,title,size = (600,650), style=wx.DEFAULT_DIALOG_STYLE)
        pnl = wx.Panel(self,-1,style=wx.SIMPLE_BORDER)
        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        hbox3 = wx.BoxSizer(wx.HORIZONTAL)
        hbox4 = wx.BoxSizer(wx.HORIZONTAL)
        vbox1 = wx.BoxSizer(wx.VERTICAL)
        vbox2 = wx.BoxSizer(wx.VERTICAL)
        vbox3 = wx.BoxSizer(wx.VERTICAL)
        gridsizer = wx.GridSizer(rows = 3,cols=2, hgap = 1, vgap = 5)
        self.oldcalcid_tc = wx.TextCtrl(pnl,size = (150,20))
        self.oldcalcid_tc.SetValue(parent.getCalcID())
        self.newcalcid_tc = wx.TextCtrl(pnl,2,size = (150,20))
        self.newcalcid_tc.SetFocus()
        self.oldorb_tc = wx.TextCtrl(pnl,size=(75,20))
        self.neworb_tc = wx.TextCtrl(pnl,size=(75,20))
        self.oldpath_tc = wx.TextCtrl(pnl, size = (300,20))
        self.newpath_tc = wx.TextCtrl(pnl, size = (300,20))
        self.input_tc = wx.TextCtrl(pnl, size = (300,300), style=wx.TE_MULTILINE)
        self.oldpath_tc.SetValue(parent.tc0.GetValue())
        self.basepath = '\\'.join(parent.tc0.GetValue().split('\\')[:-1])+'\\'
        self.newpath_tc.SetValue('\\'.join(parent.tc0.GetValue().split('\\')[:-1])+'\\')
        self.active_lc = wx.ListCtrl(pnl,4,style=wx.LC_REPORT)
        self.active_lc.InsertColumn(0, 'Orbital')
        self.active_lc.InsertColumn(1, 'Occupation Number')
        self.active_lc.InsertColumn(2, 'Orbital Type')
        self.active_lc.InsertColumn(3, 'Percentage')
        self.active_lc.SetColumnWidth(0,75)
        self.active_lc.SetColumnWidth(1,150)
        self.new_lc = wx.ListCtrl(pnl,5,style=wx.LC_REPORT)
        self.new_lc.InsertColumn(0, 'Orbital')
        self.new_lc.InsertColumn(1, 'Orbital Type')
        self.new_lc.InsertColumn(2, 'Percentage')
        self.new_lc.SetColumnWidth(0,75)
        self.new_lc.SetColumnWidth(1,150)

        server_names = servers.getServerNames()
        self.computers = wx.ComboBox(pnl,choices=server_names,style=wx.CB_READONLY)
        if len(server_names) > 0:
            self.computers.SetValue(server_names[0])

        self.processors_tc = wx.TextCtrl(pnl,size=(40,20))
        self.hours_tc = wx.TextCtrl(pnl,size=(40,20))
        self.memory_tc = wx.TextCtrl(pnl,size =(40,20))
        self.processors_tc.SetValue('32')
        self.hours_tc.SetValue('6')
        self.memory_tc.SetValue('64')

        gridsizer.Add(wx.StaticText(pnl,-1,"#of Processors :"), 0, wx.ALIGN_RIGHT, 5)
        gridsizer.Add(self.processors_tc,0,wx.ALIGN_LEFT)
        gridsizer.Add(wx.StaticText(pnl,-1,"#of Hours :"), 0, wx.ALIGN_RIGHT, 5)
        gridsizer.Add(self.hours_tc,0,wx.ALIGN_LEFT)
        gridsizer.Add(wx.StaticText(pnl,-1,"Memory in GB :"), 0, wx.ALIGN_RIGHT, 5)
        gridsizer.Add(self.memory_tc,0,wx.ALIGN_LEFT)
        
        vbox1.Add(pnl, 1, wx.EXPAND | wx.ALL, 3)
        hbox1.AddMany([(wx.StaticText(pnl, -1, 'Current CalcID :'), 0, wx.ALIGN_LEFT|wx.LEFT, 5),
                       (self.oldcalcid_tc, 0, wx.ALIGN_LEFT|wx.LEFT, 5),
                       (wx.StaticText(pnl, -1, 'New CalcID :'), 0, wx.ALIGN_LEFT|wx.LEFT, 50),
                       (self.newcalcid_tc, 2, wx.ALIGN_LEFT|wx.LEFT, 5)])
        hbox2.AddMany([(self.oldpath_tc,0,wx.ALIGN_LEFT|wx.LEFT|wx.TOP, 5),
                      (self.newpath_tc,0,wx.ALIGN_LEFT|wx.LEFT|wx.TOP, 5)])
        hbox3.AddMany([(wx.StaticText(pnl, -1, 'Active Orbital to Rotate Out :'), 0, wx.ALIGN_LEFT|wx.LEFT, 5),
                       (self.oldorb_tc, 0, wx.ALIGN_LEFT|wx.LEFT, 5),
                       (wx.StaticText(pnl, -1, 'New Orbital to Rotate In :'), 0, wx.ALIGN_LEFT|wx.LEFT, 50),
                       (self.neworb_tc, 2, wx.ALIGN_LEFT|wx.LEFT, 5)])
        hbox4.AddMany([(wx.Button(pnl, 3, 'Rotate'), 0, wx.ALIGN_LEFT|wx.LEFT|wx.TOP, 5),
                       (wx.Button(pnl,6, 'Create Calc'),0, wx.ALIGN_LEFT|wx.LEFT|wx.TOP,5),
                       (wx.Button(pnl,7, 'Launch'),0, wx.ALIGN_LEFT|wx.LEFT|wx.TOP,5),
                       (self.computers, 8, wx.EXPAND|wx.LEFT|wx.TOP,5)])
        vbox3.AddMany([(gridsizer,0,wx.ALIGN_LEFT|wx.LEFT,370),
                      (hbox4,0,wx.ALIGN_LEFT|wx.TOP,-30),
                      (self.active_lc,0,wx.EXPAND|wx.ALL,3),
                      (self.new_lc,0,wx.EXPAND|wx.ALL,3),
                      (self.input_tc,0,wx.EXPAND|wx.ALL,3)])
        vbox2.Add(hbox1,0,wx.ALIGN_LEFT|wx.TOP, 10)
        vbox2.Add(hbox2,0,wx.ALIGN_LEFT|wx.TOP, 10)
        vbox2.Add(hbox3,0,wx.ALIGN_LEFT|wx.TOP, 10)
        vbox2.Add(vbox3,0,wx.ALIGN_LEFT|wx.TOP, 10)
        pnl.SetSizer(vbox2)

        data = cas.open_file(parent.tc0.GetValue())
        start,end,nel,norb = cas.get_active(data)
        old_num_items = self.active_lc.GetItemCount()
        new_num_items = self.new_lc.GetItemCount()
        LCO = cas.get_LCO(data)
        orb_dict = cas.create_OrbDict(LCO)
        comp = cas.get_d_orbitals(LCO,Decimal(parent.tc1.GetValue()))
        for orbital in range(int(start),int(end)+1):
            self.active_lc.InsertStringItem(old_num_items, str(orbital))
            self.active_lc.SetStringItem(old_num_items,1,orb_dict[str(orbital)][1])
            old_num_items += 1
        ordered = {}
        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.new_lc.InsertStringItem(new_num_items,str(number))
                self.new_lc.SetStringItem(new_num_items,1,orb[0])
                self.new_lc.SetStringItem(new_num_items,2,orb[1])
                new_num_items += 1

        self.newcalcid_tc.Bind(wx.EVT_TEXT, self.onNewCalcID, id=2)
        self.Bind(wx.EVT_BUTTON, self.onRotateEvent, id=3)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onOldOrb, id=4)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onNewOrb, id=5)
        self.Bind(wx.EVT_BUTTON, self.onCreateCalcEvent, id = 6)
        self.Bind(wx.EVT_BUTTON, self.onLaunch, id = 7)