pKaTool/pKa_calc.py
def _calc_pKas(self,mcsteps=200000,phstep=0.1,phstart=1.0,phend=20.0,verbose=1,complete_pka=None,exp_pHs=[]):
        """Calculate pKa values from intrinsic pKa values and interaction energies. No checking done"""
        #
        # KBol and Temp are equal to 1.0 everywhere
        #
        import math
        self.ln10=math.log(10)
        #
        # Start calculating protonation states
        #
        self.mcsteps=mcsteps
        pHs=range(int(phstart*100.0),int(phend*100.0),int(phstep*100.0))
        pHvalues=[]
        for pH in pHs:
            pHvalues.append(float(pH)/100.0)

        pHvalues.extend(exp_pHs)

        self.pHvalues=pHvalues
        self.prot_states_tmp={}
        #
        # Calculate protonation states at each pH value
        #
        self.all_states={}
        import copy
        for pH in pHvalues:
            tmp,states=self.calc_fractional_charge(pH)
            if tmp=={}:
                print pH
                print 'No result'
                raise Exception('I dont believe it')
            self.prot_states_tmp[pH]=copy.deepcopy(tmp)
            self.all_states[pH]=copy.deepcopy(states)
        if verbose>1:
            print
        #
        # Determine pKas
        #
        pkavalues=self.determine_pKa_values()
        #
        # Reformat the titration data
        #
        self.prot_states={}
        for group in self.groups:
            self.prot_states[group]={}
            for ph in pHvalues:
                self.prot_states[group][ph]=self.prot_states_tmp[ph][group]
            self.prot_states[group]['pKa']=pkavalues[group]
        self.prot_states_tmp=None
        #
        # ----------
        #
        self.pka={}
        for group in pkavalues.keys():
            self.pka[group]={'pKa':pkavalues[group]}
        if complete_pka:
            self.complete_pka()

        return pkavalues,self.prot_states
Calculate pKa values from intrinsic pKa values and interaction energies. No checking done
Calculate pKa values from intrinsic pKa values and interaction energies. No checking done
Calculate pKa values from intrinsic pKa values and interaction energies . No checking done
def _calc_pKas(self,mcsteps=200000,phstep=0.1,phstart=1.0,phend=20.0,verbose=1,complete_pka=None,exp_pHs=[]):
         KBol and Temp are equal to 1.0 everywhere
        import math
        self.ln10=math.log(10)
         Start calculating protonation states
        self.mcsteps=mcsteps
        pHs=range(int(phstart*100.0),int(phend*100.0),int(phstep*100.0))
        pHvalues=[]
        for pH in pHs:
            pHvalues.append(float(pH)/100.0)
        pHvalues.extend(exp_pHs)
        self.pHvalues=pHvalues
        self.prot_states_tmp={}
         Calculate protonation states at each pH value
        self.all_states={}
        import copy
        for pH in pHvalues:
            tmp,states=self.calc_fractional_charge(pH)
            if tmp=={}:
                print pH
                print 'No result'
                raise Exception('I dont believe it')
            self.prot_states_tmp[pH]=copy.deepcopy(tmp)
            self.all_states[pH]=copy.deepcopy(states)
        if verbose>1:
            print
         Determine pKas
        pkavalues=self.determine_pKa_values()
         Reformat the titration data
        self.prot_states={}
        for group in self.groups:
            self.prot_states[group]={}
            for ph in pHvalues:
                self.prot_states[group][ph]=self.prot_states_tmp[ph][group]
            self.prot_states[group]['pKa']=pkavalues[group]
        self.prot_states_tmp=None
         ----------
        self.pka={}
        for group in pkavalues.keys():
            self.pka[group]={'pKa':pkavalues[group]}
        if complete_pka:
            self.complete_pka()
        return pkavalues,self.prot_states
def _calc_pKas ( self , mcsteps = 200000 , phstep = 0.1 , phstart = 1.0 , phend = 20.0 , verbose = 1 , complete_pka = None , exp_pHs = [ ] ) : import math self . ln10 = math . log ( 10 ) self . mcsteps = mcsteps pHs = range ( int ( phstart * 100.0 ) , int ( phend * 100.0 ) , int ( phstep * 100.0 ) ) pHvalues = [ ] for pH in pHs : pHvalues . append ( float ( pH ) / 100.0 ) pHvalues . extend ( exp_pHs ) self . pHvalues = pHvalues self . prot_states_tmp = { } self . all_states = { } import copy for pH in pHvalues : tmp , states = self . calc_fractional_charge ( pH ) if tmp == { } : print pH print 'No result' raise Exception ( 'I dont believe it' ) self . prot_states_tmp [ pH ] = copy . deepcopy ( tmp ) self . all_states [ pH ] = copy . deepcopy ( states ) if verbose > 1 : print pkavalues = self . determine_pKa_values ( ) self . prot_states = { } for group in self . groups : self . prot_states [ group ] = { } for ph in pHvalues : self . prot_states [ group ] [ ph ] = self . prot_states_tmp [ ph ] [ group ] self . prot_states [ group ] [ 'pKa' ] = pkavalues [ group ] self . prot_states_tmp = None self . pka = { } for group in pkavalues . keys ( ) : self . pka [ group ] = { 'pKa' : pkavalues [ group ] } if complete_pka : self . complete_pka ( ) return pkavalues , self . prot_states
Calculate pKa values from intrinsic pKa values and interaction energies.
Calculate pKa values from intrinsic pKa values and interaction energies .
"""Calculate pKa values from intrinsic pKa values and interaction energies. No checking done""" # # KBol and Temp are equal to 1.0 everywhere # # # Start calculating protonation states # # # Calculate protonation states at each pH value # # # Determine pKas # # # Reformat the titration data # # # ---------- #
self
mcsteps
phstep
phstart
phend
verbose
complete_pka
exp_pHs