Ghost/EM_effect.py
def def_titgrp(self):
        """Define a titratable group
        There are two steps
        1. Define the position
        2. Define the titrational behaviour
        
        """
        self.seldef_win=Toplevel()
        self.set_geometry(self.master,self.seldef_win)
        self.seldef_win.title('Select/Define titratable group')
        Label(self.seldef_win,text='Titratable group').grid(row=1,column=0)
        Button(self.seldef_win,text='Select from PDB file',command=self.select_titgrp_frompdb).grid(row=1,column=2)
        Button(self.seldef_win,text='Define XYZ manually',state='disabled').grid(row=1,column=3)
        
        #
        # Titration behaviour
        #
        Label(self.seldef_win,text='Titration curve').grid(row=10,column=0)
        Checkbutton(self.seldef_win,text='Copy from pKa_system',command=self.copy_from_pkasystem).grid(row=10,column=1)
        def model_unit_charge():
            self.charge=1.0
            self.sel_titgrp=StringVar()
            self.sel_titgrp.set('Unit charge')
            return
        self.unit_charge=IntVar()
        Checkbutton(self.seldef_win,text='Model as unit charge',variable=self.unit_charge,onvalue=1,offvalue=0,command=model_unit_charge).grid(row=10,column=2)
        model_unit_charge()
        #
        # Nitrogen or Hydrogen chemical shift
        #
        self.chemshift_type=IntVar()
        Label(self.seldef_win,text='Calculate chemical shift for').grid(row=11,column=0)
        Radiobutton(self.seldef_win,
                    text='Backbone amide nitrogen',
                    value=0,
                    variable=self.chemshift_type).grid(row=11,column=1)
        Radiobutton(self.seldef_win,
                    text='Backbone amide hydrogen',
                    value=1,
                    variable=self.chemshift_type).grid(row=11,column=2)
        self.chemshift_type.set(0)
        #
        # Add group button
        #
        def add_group():
            #
            # Add to listbox
            #
            if not hasattr(self,'selected_groups'):
                self.selected_groups=[]
            titgroups=self.PI.titratable_groups.keys()
            titgroups.sort()
            selection=self.LB_groups.curselection()
            selection=int(selection[0])
            
            #
            # Get the type (N or H), and construct the name from it
            #
            if self.chemshift_type.get()==0:
                name='%s - %s' %(self.titgroups_inPDB[selection],'N')
                self.group_properties[name]={'colour':'red','diel':8,'display':1,'atom':'N'}
            else:
                name='%s - %s' %(self.titgroups_inPDB[selection],'H')
                self.group_properties[name]={'colour':'red','diel':8,'display':1,'atom':'H'}
            #
            # Add to listbox
            #
            self.selected_groups.append([name,self.titgroups_inPDB[selection],self.sel_titgrp.get()])
            self.LB_added_groups.insert(END,str(self.selected_groups[-1]))
            #
            # Activate the callback from pKa_system 
            #
            if hasattr(self,'PS'):
                self.PS.add_callback(self.update_EM_effect_prediction)
            else:
                self.update_EM_effect_prediction()
            return
        Button(self.seldef_win,text='Add group',command=add_group).grid(row=13,column=0)
        return
Define a titratable group
        There are two steps
        1. Define the position
        2. Define the titrational behaviour
        
        
Define a titratable group
There are two steps
1. Define the position
2. Define the titrational behaviour
Define a titratable group There are two steps 1 . Define the position 2 . Define the titrational behaviour
def def_titgrp(self):
        self.seldef_win=Toplevel()
        self.set_geometry(self.master,self.seldef_win)
        self.seldef_win.title('Select/Define titratable group')
        Label(self.seldef_win,text='Titratable group').grid(row=1,column=0)
        Button(self.seldef_win,text='Select from PDB file',command=self.select_titgrp_frompdb).grid(row=1,column=2)
        Button(self.seldef_win,text='Define XYZ manually',state='disabled').grid(row=1,column=3)
         Titration behaviour
        Label(self.seldef_win,text='Titration curve').grid(row=10,column=0)
        Checkbutton(self.seldef_win,text='Copy from pKa_system',command=self.copy_from_pkasystem).grid(row=10,column=1)
        def model_unit_charge():
            self.charge=1.0
            self.sel_titgrp=StringVar()
            self.sel_titgrp.set('Unit charge')
            return
        self.unit_charge=IntVar()
        Checkbutton(self.seldef_win,text='Model as unit charge',variable=self.unit_charge,onvalue=1,offvalue=0,command=model_unit_charge).grid(row=10,column=2)
        model_unit_charge()
         Nitrogen or Hydrogen chemical shift
        self.chemshift_type=IntVar()
        Label(self.seldef_win,text='Calculate chemical shift for').grid(row=11,column=0)
        Radiobutton(self.seldef_win,
                    text='Backbone amide nitrogen',
                    value=0,
                    variable=self.chemshift_type).grid(row=11,column=1)
        Radiobutton(self.seldef_win,
                    text='Backbone amide hydrogen',
                    value=1,
                    variable=self.chemshift_type).grid(row=11,column=2)
        self.chemshift_type.set(0)
         Add group button
        def add_group():
             Add to listbox
            if not hasattr(self,'selected_groups'):
                self.selected_groups=[]
            titgroups=self.PI.titratable_groups.keys()
            titgroups.sort()
            selection=self.LB_groups.curselection()
            selection=int(selection[0])
             Get the type (N or H), and construct the name from it
            if self.chemshift_type.get()==0:
                name='%s - %s' %(self.titgroups_inPDB[selection],'N')
                self.group_properties[name]={'colour':'red','diel':8,'display':1,'atom':'N'}
            else:
                name='%s - %s' %(self.titgroups_inPDB[selection],'H')
                self.group_properties[name]={'colour':'red','diel':8,'display':1,'atom':'H'}
             Add to listbox
            self.selected_groups.append([name,self.titgroups_inPDB[selection],self.sel_titgrp.get()])
            self.LB_added_groups.insert(END,str(self.selected_groups[-1]))
             Activate the callback from pKa_system 
            if hasattr(self,'PS'):
                self.PS.add_callback(self.update_EM_effect_prediction)
            else:
                self.update_EM_effect_prediction()
            return
        Button(self.seldef_win,text='Add group',command=add_group).grid(row=13,column=0)
        return
def def_titgrp ( self ) : self . seldef_win = Toplevel ( ) self . set_geometry ( self . master , self . seldef_win ) self . seldef_win . title ( 'Select/Define titratable group' ) Label ( self . seldef_win , text = 'Titratable group' ) . grid ( row = 1 , column = 0 ) Button ( self . seldef_win , text = 'Select from PDB file' , command = self . select_titgrp_frompdb ) . grid ( row = 1 , column = 2 ) Button ( self . seldef_win , text = 'Define XYZ manually' , state = 'disabled' ) . grid ( row = 1 , column = 3 ) Label ( self . seldef_win , text = 'Titration curve' ) . grid ( row = 10 , column = 0 ) Checkbutton ( self . seldef_win , text = 'Copy from pKa_system' , command = self . copy_from_pkasystem ) . grid ( row = 10 , column = 1 ) def model_unit_charge ( ) : self . charge = 1.0 self . sel_titgrp = StringVar ( ) self . sel_titgrp . set ( 'Unit charge' ) return self . unit_charge = IntVar ( ) Checkbutton ( self . seldef_win , text = 'Model as unit charge' , variable = self . unit_charge , onvalue = 1 , offvalue = 0 , command = model_unit_charge ) . grid ( row = 10 , column = 2 ) model_unit_charge ( ) self . chemshift_type = IntVar ( ) Label ( self . seldef_win , text = 'Calculate chemical shift for' ) . grid ( row = 11 , column = 0 ) Radiobutton ( self . seldef_win , text = 'Backbone amide nitrogen' , value = 0 , variable = self . chemshift_type ) . grid ( row = 11 , column = 1 ) Radiobutton ( self . seldef_win , text = 'Backbone amide hydrogen' , value = 1 , variable = self . chemshift_type ) . grid ( row = 11 , column = 2 ) self . chemshift_type . set ( 0 ) def add_group ( ) : if not hasattr ( self , 'selected_groups' ) : self . selected_groups = [ ] titgroups = self . PI . titratable_groups . keys ( ) titgroups . sort ( ) selection = self . LB_groups . curselection ( ) selection = int ( selection [ 0 ] ) if self . chemshift_type . get ( ) == 0 : name = '%s - %s' % ( self . titgroups_inPDB [ selection ] , 'N' ) self . group_properties [ name ] = { 'colour' : 'red' , 'diel' : 8 , 'display' : 1 , 'atom' : 'N' } else : name = '%s - %s' % ( self . titgroups_inPDB [ selection ] , 'H' ) self . group_properties [ name ] = { 'colour' : 'red' , 'diel' : 8 , 'display' : 1 , 'atom' : 'H' } self . selected_groups . append ( [ name , self . titgroups_inPDB [ selection ] , self . sel_titgrp . get ( ) ] ) self . LB_added_groups . insert ( END , str ( self . selected_groups [ - 1 ] ) ) if hasattr ( self , 'PS' ) : self . PS . add_callback ( self . update_EM_effect_prediction ) else : self . update_EM_effect_prediction ( ) return Button ( self . seldef_win , text = 'Add group' , command = add_group ) . grid ( row = 13 , column = 0 ) return
Define a titratable group
There are two steps
1.
Define a titratable group There are two steps 1 .
"""Define a titratable group
        There are two steps
        1. Define the position
        2. Define the titrational behaviour
        
        """ # # Titration behaviour # # # Nitrogen or Hydrogen chemical shift # # # Add group button # # # Add to listbox # # # Get the type (N or H), and construct the name from it # # # Add to listbox # # # Activate the callback from pKa_system  #
self