Esempio n. 1
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)
Esempio n. 2
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)
Esempio n. 3
0
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self,
                           parent,
                           id,
                           title,
                           size=(600, 700),
                           style=wx.DEFAULT_DIALOG_STYLE)
        self.status = 0
        self.p = ''
        self.threshold = 10

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        hbox3 = wx.BoxSizer(wx.HORIZONTAL)
        hbox4 = wx.BoxSizer(wx.HORIZONTAL)
        hbox5 = wx.BoxSizer(wx.HORIZONTAL)
        hbox6 = wx.BoxSizer(wx.HORIZONTAL)
        hbox7 = wx.BoxSizer(wx.HORIZONTAL)
        hbox8 = wx.BoxSizer(wx.HORIZONTAL)
        hbox9 = wx.BoxSizer(wx.HORIZONTAL)
        vbox1 = wx.BoxSizer(wx.VERTICAL)
        vbox2 = wx.BoxSizer(wx.VERTICAL)
        vbox3 = wx.BoxSizer(wx.VERTICAL)
        vbox4 = wx.BoxSizer(wx.VERTICAL)
        grid1 = wx.GridSizer(rows=5, cols=2, hgap=-70, vgap=-200)
        pnl1 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
        pnl2 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
        vbox1.Add(pnl1, 1, wx.EXPAND | wx.ALL, 3)
        vbox1.Add(pnl2, 1, wx.EXPAND | wx.ALL, 3)
        pnl1.SetSizer(vbox3)
        pnl2.SetSizer(vbox4)
        hbox.Add(vbox1, 1, wx.EXPAND)
        hbox.Add(vbox2, 1, wx.EXPAND)
        self.SetSizer(hbox)

        self.lc = wx.ListCtrl(self, 11, style=wx.LC_REPORT)
        self.lc.InsertColumn(0, 'Orbital')
        self.lc.InsertColumn(1, 'Occupation Number')
        self.lc.SetColumnWidth(0, 115)
        self.lc.SetColumnWidth(1, 140)
        vbox2.Add(self.lc, 1, wx.EXPAND | wx.ALL, 3)

        self.tc0 = wx.TextCtrl(pnl1, size=(310, 20))
        self.tc1 = wx.TextCtrl(pnl1, size=(50, 20))
        self.tc2 = wx.TextCtrl(pnl1, size=(50, 20))
        self.tc3 = wx.TextCtrl(pnl1, size=(50, 20))
        self.tc4 = wx.TextCtrl(pnl1, size=(50, 20))
        self.tc5 = wx.TextCtrl(pnl1, size=(125, 20))
        self.nel_tc = wx.TextCtrl(pnl1, size=(50, 20))
        self.norb_tc = wx.TextCtrl(pnl1, size=(50, 20))
        self.rangestart_tc = wx.TextCtrl(pnl1, size=(50, 20))
        self.rangeend_tc = wx.TextCtrl(pnl1, size=(50, 20))

        upload_image = wx.Image('images/upload_icon.jpg',
                                wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        download_image = wx.Image('images/download_icon.jpg',
                                  wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        delete_image = wx.Image('images/delete_icon.png',
                                wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        open_image = wx.Image('images/open_folder_icon.jpg',
                              wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        self.uploadButton = wx.BitmapButton(
            pnl1,
            21,
            bitmap=upload_image,
            size=(upload_image.GetWidth() + 5, upload_image.GetHeight() + 5))
        self.downloadButton = wx.BitmapButton(
            pnl1,
            22,
            bitmap=download_image,
            size=(download_image.GetWidth() + 5,
                  download_image.GetHeight() + 5))
        self.deleteButton = wx.BitmapButton(
            pnl1,
            23,
            bitmap=delete_image,
            size=(delete_image.GetWidth() + 5, delete_image.GetHeight() + 5))
        self.openButton = wx.BitmapButton(pnl1,
                                          30,
                                          bitmap=open_image,
                                          size=(open_image.GetWidth() + 5,
                                                open_image.GetHeight() + 5))
        self.uploadButton.SetToolTipString('Upload to server')
        self.downloadButton.SetToolTipString('Download from server')
        self.deleteButton.SetToolTipString('Delete folder from server')
        self.openButton.SetToolTipString('Open folder')

        server_names = servers.getServerNames()
        self.computers = wx.ComboBox(pnl1,
                                     choices=server_names,
                                     style=wx.CB_READONLY)
        if len(server_names) > 0:
            self.computers.SetValue(server_names[0])
        self.tc1.SetValue('10.0')
        self.tc4.SetValue('0.05')

        self.units = wx.ComboBox(
            pnl1,
            24,
            value='kcal/mol',
            choices=['kcal/mol', 'eV', 'hartrees', 'kJ/mol'],
            style=wx.CB_READONLY)
        self.units.SetValue('kcal/mol')

        self.mulliken = wx.RadioButton(pnl2, 27, 'Mulliken', style=wx.RB_GROUP)
        self.loewdin = wx.RadioButton(pnl2, 28, 'Loewdin')

        hbox1.AddMany([(wx.StaticText(pnl1, -1,
                                      'CAS Output File'), 0, wx.ALIGN_LEFT),
                       (wx.Button(pnl1, 10,
                                  'Browse...'), 0, wx.ALIGN_LEFT | wx.LEFT, 5),
                       (self.uploadButton, 0, wx.ALIGN_LEFT | wx.LEFT, 5),
                       (self.downloadButton, 0, wx.ALIGN_LEFT | wx.LEFT, 5),
                       (self.deleteButton, 0, wx.ALIGN_LEFT | wx.LEFT, 5),
                       (self.openButton, 0, wx.ALIGN_LEFT | wx.LEFT, 5)])
        hbox2.AddMany([(self.nel_tc, 0, wx.ALIGN_LEFT | wx.LEFT, 5),
                       (wx.StaticText(pnl1, -1, 'active electrons in '), 0,
                        wx.ALIGN_LEFT | wx.LEFT, 5),
                       (self.norb_tc, 0, wx.ALIGN_LEFT | wx.LEFT, 5),
                       (wx.StaticText(pnl1, -1, 'in active orbitals'), 0,
                        wx.ALIGN_LEFT | wx.LEFT, 5)])
        hbox3.AddMany([(wx.StaticText(pnl1, -1, 'Orbital % Threshold :'), 0,
                        wx.ALIGN_LEFT),
                       (self.tc1, 0, wx.ALIGN_LEFT | wx.LEFT, 5)])
        hbox4.AddMany([(wx.StaticText(pnl1, -1,
                                      'Element/Number :'), 0, wx.ALIGN_LEFT),
                       (self.tc2, 0, wx.ALIGN_LEFT | wx.LEFT, 5)])
        hbox5.AddMany([(wx.StaticText(pnl1, -1,
                                      'Orbital Type :'), 0, wx.ALIGN_LEFT),
                       (self.tc3, 0, wx.ALIGN_LEFT | wx.LEFT, 5)])
        hbox6.AddMany([(wx.StaticText(pnl1, -1,
                                      'Orbital Range :'), 0, wx.ALIGN_LEFT),
                       (self.rangestart_tc, 0, wx.ALIGN_LEFT | wx.LEFT, 5),
                       (wx.StaticText(pnl1, -1,
                                      '–'), 0, wx.ALIGN_LEFT | wx.LEFT, 5),
                       (self.rangeend_tc, 0, wx.ALIGN_LEFT | wx.LEFT, 5)])
        hbox7.AddMany([(wx.StaticText(pnl1, -1,
                                      'Isovalue :'), 0, wx.ALIGN_LEFT),
                       (self.tc4, 0, wx.ALIGN_LEFT | wx.LEFT, 5)])
        hbox8.AddMany([(wx.StaticText(pnl1, -1, 'Computer :'), 0,
                        wx.ALIGN_LEFT | wx.TOP, 5),
                       (self.computers, 1, wx.EXPAND | wx.ALL, 3)])
        hbox9.AddMany([(wx.StaticText(pnl1, -1, 'Single Point Energy'), 0,
                        wx.ALIGN_LEFT | wx.LEFT, 5),
                       (self.tc5, 0, wx.ALIGN_LEFT | wx.LEFT, 5),
                       (self.units, 0,
                        wx.ALIGN_LEFT | wx.BOTTOM | wx.LEFT | wx.RIGHT, 5)])
        vbox3.AddMany([(hbox1, 0, wx.ALIGN_LEFT | wx.LEFT, 5),
                       (self.tc0, 0, wx.ALIGN_LEFT | wx.ALIGN_TOP | wx.TOP, 5),
                       (hbox2, 0, wx.ALIGN_LEFT | wx.TOP | wx.LEFT, 5),
                       (hbox3, 0, wx.ALIGN_LEFT | wx.TOP | wx.LEFT, 5),
                       (hbox4, 0, wx.ALIGN_LEFT | wx.TOP | wx.LEFT, 5),
                       (hbox5, 0, wx.ALIGN_LEFT | wx.TOP | wx.LEFT, 5),
                       (hbox6, 0, wx.ALIGN_LEFT | wx.TOP | wx.LEFT, 5),
                       (hbox7, 0, wx.ALIGN_LEFT | wx.TOP | wx.LEFT, 5),
                       (hbox8, 0, wx.ALIGN_LEFT | wx.TOP | wx.LEFT, 5),
                       (hbox9, 0, wx.ALIGN_LEFT | wx.TOP, 55)])

        grid1.Add(wx.Button(pnl2, 15, 'Active Space'), 0,
                  wx.ALIGN_CENTER | wx.TOP, 15)
        grid1.Add(wx.Button(pnl2, 16, 'Get Orbitals'), 0,
                  wx.ALIGN_CENTER | wx.TOP, 15)
        grid1.Add(wx.Button(pnl2, 20, 'Plot Listed Orbitals'), 0,
                  wx.ALIGN_CENTER | wx.TOP, 15)
        grid1.Add(wx.Button(pnl2, 17, 'Rotate Orbitals'), 0,
                  wx.ALIGN_CENTER | wx.TOP, 15)
        grid1.Add(wx.Button(pnl2, 25, 'Spin Densities'), 0,
                  wx.ALIGN_CENTER | wx.TOP, 15)
        grid1.Add(wx.Button(pnl2, 26, 'Atomic Charges'), 0,
                  wx.ALIGN_CENTER | wx.TOP, 15)
        grid1.Add(self.mulliken, 0, wx.ALIGN_CENTER | wx.TOP, 15)
        grid1.Add(self.loewdin, 0, wx.ALIGN_CENTER | wx.TOP, 15)
        grid1.Add(wx.Button(pnl2, 19, 'Import Energy'), 0,
                  wx.ALIGN_CENTER | wx.TOP, 15)
        grid1.Add(wx.Button(pnl2, 29, 'EEC'), 0, wx.ALIGN_CENTER | wx.TOP, 15)
        #grid1.Add(wx.Button(pnl2, 13, 'Clear'), 0, wx.ALIGN_CENTER| wx.TOP, 15)
        vbox4.Add(grid1, 1, wx.EXPAND | wx.TOP, -70)
        vbox4.Add(wx.Button(pnl2, 18, 'Servers'), 0, wx.ALIGN_LEFT | wx.TOP,
                  -10)

        self.Bind(wx.EVT_BUTTON, self.onBrowse, id=10)
        self.Bind(wx.EVT_BUTTON, self.onClear, id=13)
        self.Bind(wx.EVT_BUTTON, self.onActive, id=15)
        self.Bind(wx.EVT_BUTTON, self.onComp, id=16)
        self.Bind(wx.EVT_BUTTON, self.onRotateOrbs, id=17)
        self.Bind(wx.EVT_BUTTON, self.onServers, id=18)
        self.Bind(wx.EVT_BUTTON, self.onImportSPE, id=19)
        self.Bind(wx.EVT_BUTTON, self.onPlotOrb, id=20)
        self.Bind(wx.EVT_BUTTON, self.onUpload, id=21)
        self.Bind(wx.EVT_BUTTON, self.onDownload, id=22)
        self.Bind(wx.EVT_BUTTON, self.onDelete, id=23)
        self.Bind(wx.EVT_BUTTON, self.onOpenFolder, id=30)
        self.Bind(wx.EVT_BUTTON, self.onSpin, id=25)
        self.Bind(wx.EVT_BUTTON, self.onCharge, id=26)
        self.Bind(wx.EVT_BUTTON, self.onEEC, id=29)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onViewOrb, id=11)
        self.Bind(wx.EVT_COMBOBOX, self.onImportSPE, id=24)
Esempio n. 4
0
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self, parent, id, title, size=(600,700), style=wx.DEFAULT_DIALOG_STYLE)
        self.status = 0
        self.p = ''
        self.threshold = 10
        
        hbox  = wx.BoxSizer(wx.HORIZONTAL)
        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        hbox3 = wx.BoxSizer(wx.HORIZONTAL)
        hbox4 = wx.BoxSizer(wx.HORIZONTAL)
        hbox5 = wx.BoxSizer(wx.HORIZONTAL)
        hbox6 = wx.BoxSizer(wx.HORIZONTAL)
        hbox7 = wx.BoxSizer(wx.HORIZONTAL)
        hbox8 = wx.BoxSizer(wx.HORIZONTAL)
        hbox9 = wx.BoxSizer(wx.HORIZONTAL)
        vbox1 = wx.BoxSizer(wx.VERTICAL)
        vbox2 = wx.BoxSizer(wx.VERTICAL)
        vbox3 = wx.BoxSizer(wx.VERTICAL)
        vbox4 = wx.BoxSizer(wx.VERTICAL)
        grid1 = wx.GridSizer(rows=5,cols=2,hgap = -70, vgap = -200)
        pnl1 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
        pnl2 = wx.Panel(self, -1, style=wx.SIMPLE_BORDER)
        vbox1.Add(pnl1, 1, wx.EXPAND | wx.ALL, 3)
        vbox1.Add(pnl2, 1, wx.EXPAND | wx.ALL, 3)
        pnl1.SetSizer(vbox3)
        pnl2.SetSizer(vbox4)
        hbox.Add(vbox1, 1, wx.EXPAND)
        hbox.Add(vbox2, 1, wx.EXPAND)
        self.SetSizer(hbox)
        
        self.lc = wx.ListCtrl(self, 11, style=wx.LC_REPORT)
        self.lc.InsertColumn(0, 'Orbital')
        self.lc.InsertColumn(1, 'Occupation Number')
        self.lc.SetColumnWidth(0, 115)
        self.lc.SetColumnWidth(1, 140)
        vbox2.Add(self.lc, 1, wx.EXPAND | wx.ALL, 3)

        self.tc0 = wx.TextCtrl(pnl1,size=(310,20))
        self.tc1 = wx.TextCtrl(pnl1,size=(50,20))
        self.tc2 = wx.TextCtrl(pnl1,size=(50,20))
        self.tc3 = wx.TextCtrl(pnl1,size=(50,20))
        self.tc4 = wx.TextCtrl(pnl1,size=(50,20))
        self.tc5 = wx.TextCtrl(pnl1,size=(125,20))
        self.nel_tc = wx.TextCtrl(pnl1,size=(50,20))
        self.norb_tc = wx.TextCtrl(pnl1,size=(50,20))
        self.rangestart_tc = wx.TextCtrl(pnl1, size=(50,20))
        self.rangeend_tc = wx.TextCtrl(pnl1, size=(50,20))
        
        upload_image = wx.Image('images/upload_icon.jpg', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        download_image = wx.Image('images/download_icon.jpg', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        delete_image = wx.Image('images/delete_icon.png', wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        open_image = wx.Image('images/open_folder_icon.jpg',wx.BITMAP_TYPE_ANY).ConvertToBitmap()
        self.uploadButton = wx.BitmapButton(pnl1, 21, bitmap = upload_image, size=(upload_image.GetWidth()+5, upload_image.GetHeight()+5))
        self.downloadButton = wx.BitmapButton(pnl1, 22, bitmap = download_image, size=(download_image.GetWidth()+5, download_image.GetHeight()+5))
        self.deleteButton = wx.BitmapButton(pnl1, 23, bitmap = delete_image, size=(delete_image.GetWidth()+5, delete_image.GetHeight()+5))
        self.openButton = wx.BitmapButton(pnl1, 30, bitmap = open_image, size=(open_image.GetWidth()+5, open_image.GetHeight()+5))
        self.uploadButton.SetToolTipString('Upload to server')
        self.downloadButton.SetToolTipString('Download from server')
        self.deleteButton.SetToolTipString('Delete folder from server')
        self.openButton.SetToolTipString('Open folder')

        server_names = servers.getServerNames()
        self.computers = wx.ComboBox(pnl1,choices=server_names,style=wx.CB_READONLY)
        if len(server_names) > 0:
            self.computers.SetValue(server_names[0])
        self.tc1.SetValue('10.0')
        self.tc4.SetValue('0.05')

        self.units = wx.ComboBox(pnl1,24, value = 'kcal/mol',choices=['kcal/mol','eV','hartrees','kJ/mol'],style=wx.CB_READONLY)
        self.units.SetValue('kcal/mol')

        self.mulliken = wx.RadioButton(pnl2, 27, 'Mulliken', style=wx.RB_GROUP)
        self.loewdin = wx.RadioButton(pnl2, 28, 'Loewdin')

        hbox1.AddMany([(wx.StaticText(pnl1, -1, 'CAS Output File'), 0, wx.ALIGN_LEFT),
                                 (wx.Button(pnl1, 10, 'Browse...'),0, wx.ALIGN_LEFT|wx.LEFT,5),
                                 (self.uploadButton, 0, wx.ALIGN_LEFT|wx.LEFT,5),
                                 (self.downloadButton, 0, wx.ALIGN_LEFT|wx.LEFT, 5),
                                 (self.deleteButton, 0, wx.ALIGN_LEFT|wx.LEFT, 5),
                                 (self.openButton, 0, wx.ALIGN_LEFT|wx.LEFT, 5)])
        hbox2.AddMany([(self.nel_tc,0,wx.ALIGN_LEFT|wx.LEFT,5),
                       (wx.StaticText(pnl1, -1, 'active electrons in '), 0, wx.ALIGN_LEFT|wx.LEFT,5),
                       (self.norb_tc,0,wx.ALIGN_LEFT|wx.LEFT,5),
                       (wx.StaticText(pnl1, -1, 'in active orbitals'), 0, wx.ALIGN_LEFT|wx.LEFT, 5)])
        hbox3.AddMany([(wx.StaticText(pnl1, -1, 'Orbital % Threshold :'), 0, wx.ALIGN_LEFT),
                      (self.tc1,0,wx.ALIGN_LEFT|wx.LEFT,5)])
        hbox4.AddMany([(wx.StaticText(pnl1, -1, 'Element/Number :'), 0, wx.ALIGN_LEFT),
                      (self.tc2,0,wx.ALIGN_LEFT|wx.LEFT,5)])
        hbox5.AddMany([(wx.StaticText(pnl1, -1, 'Orbital Type :'), 0, wx.ALIGN_LEFT),
                      (self.tc3,0,wx.ALIGN_LEFT|wx.LEFT,5)])
        hbox6.AddMany([(wx.StaticText(pnl1, -1, 'Orbital Range :'), 0, wx.ALIGN_LEFT),
                      (self.rangestart_tc,0,wx.ALIGN_LEFT|wx.LEFT,5),
                       (wx.StaticText(pnl1, -1, '–'), 0, wx.ALIGN_LEFT|wx.LEFT,5),
                      (self.rangeend_tc,0,wx.ALIGN_LEFT|wx.LEFT,5)])
        hbox7.AddMany([(wx.StaticText(pnl1, -1, 'Isovalue :'), 0, wx.ALIGN_LEFT),
                      (self.tc4,0,wx.ALIGN_LEFT|wx.LEFT,5)])
        hbox8.AddMany([(wx.StaticText(pnl1, -1, 'Computer :'), 0, wx.ALIGN_LEFT|wx.TOP, 5),(self.computers, 1, wx.EXPAND | wx.ALL, 3)])
        hbox9.AddMany([(wx.StaticText(pnl1, -1, 'Single Point Energy'), 0, wx.ALIGN_LEFT|wx.LEFT, 5),
                      (self.tc5,0,wx.ALIGN_LEFT|wx.LEFT,5),
                      (self.units, 0, wx.ALIGN_LEFT|wx.BOTTOM|wx.LEFT|wx.RIGHT, 5)])
        vbox3.AddMany([(hbox1, 0, wx.ALIGN_LEFT|wx.LEFT, 5),
                       (self.tc0, 0, wx.ALIGN_LEFT|wx.ALIGN_TOP|wx.TOP, 5),
                       (hbox2, 0, wx.ALIGN_LEFT|wx.TOP|wx.LEFT, 5),
                       (hbox3, 0, wx.ALIGN_LEFT|wx.TOP|wx.LEFT, 5),
                       (hbox4, 0, wx.ALIGN_LEFT|wx.TOP|wx.LEFT, 5),
                       (hbox5, 0, wx.ALIGN_LEFT|wx.TOP|wx.LEFT, 5),
                       (hbox6, 0, wx.ALIGN_LEFT|wx.TOP|wx.LEFT, 5),
                       (hbox7, 0, wx.ALIGN_LEFT|wx.TOP|wx.LEFT, 5),
                       (hbox8, 0, wx.ALIGN_LEFT|wx.TOP|wx.LEFT, 5),
                       (hbox9, 0, wx.ALIGN_LEFT|wx.TOP, 55)])

        grid1.Add(wx.Button(pnl2, 15, 'Active Space'), 0, wx.ALIGN_CENTER|wx.TOP, 15)
        grid1.Add(wx.Button(pnl2, 16, 'Get Orbitals'), 0, wx.ALIGN_CENTER|wx.TOP, 15)
        grid1.Add(wx.Button(pnl2, 20, 'Plot Listed Orbitals'), 0, wx.ALIGN_CENTER|wx.TOP, 15)
        grid1.Add(wx.Button(pnl2, 17, 'Rotate Orbitals'), 0, wx.ALIGN_CENTER| wx.TOP, 15)
        grid1.Add(wx.Button(pnl2, 25, 'Spin Densities'), 0, wx.ALIGN_CENTER|wx.TOP, 15)
        grid1.Add(wx.Button(pnl2, 26, 'Atomic Charges'), 0, wx.ALIGN_CENTER|wx.TOP, 15)
        grid1.Add(self.mulliken, 0, wx.ALIGN_CENTER|wx.TOP,15)
        grid1.Add(self.loewdin, 0, wx.ALIGN_CENTER|wx.TOP,15)
        grid1.Add(wx.Button(pnl2, 19, 'Import Energy'), 0, wx.ALIGN_CENTER| wx.TOP, 15)
        grid1.Add(wx.Button(pnl2, 29, 'EEC'), 0, wx.ALIGN_CENTER| wx.TOP, 15)
        #grid1.Add(wx.Button(pnl2, 13, 'Clear'), 0, wx.ALIGN_CENTER| wx.TOP, 15)
        vbox4.Add(grid1, 1, wx.EXPAND|wx.TOP, -70)
        vbox4.Add(wx.Button(pnl2, 18, 'Servers'), 0, wx.ALIGN_LEFT|wx.TOP, -10)

        self.Bind(wx.EVT_BUTTON, self.onBrowse, id=10)
        self.Bind(wx.EVT_BUTTON, self.onClear, id=13)
        self.Bind(wx.EVT_BUTTON, self.onActive, id=15)
        self.Bind(wx.EVT_BUTTON, self.onComp, id=16)
        self.Bind(wx.EVT_BUTTON, self.onRotateOrbs, id=17)
        self.Bind(wx.EVT_BUTTON, self.onServers, id=18)
        self.Bind(wx.EVT_BUTTON, self.onImportSPE, id=19)
        self.Bind(wx.EVT_BUTTON, self.onPlotOrb, id=20)
        self.Bind(wx.EVT_BUTTON, self.onUpload, id=21)
        self.Bind(wx.EVT_BUTTON, self.onDownload, id=22)
        self.Bind(wx.EVT_BUTTON, self.onDelete, id=23)
        self.Bind(wx.EVT_BUTTON, self.onOpenFolder, id=30)
        self.Bind(wx.EVT_BUTTON, self.onSpin, id =25)
        self.Bind(wx.EVT_BUTTON, self.onCharge, id=26)
        self.Bind(wx.EVT_BUTTON, self.onEEC, id=29)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onViewOrb, id=11)
        self.Bind(wx.EVT_COMBOBOX, self.onImportSPE, id=24)