def ret_BO(self, state): """ Return the bond order and compute some descriptors related to the bond order. """ if 'BO' in state: return state['BO'] try: D = state['sden'] except KeyError: return None print("Computation of the bond order matrix ...") temp = self.mos.CdotD(D, trnsp=False, inv=False) # C.DAO DS = self.mos.MdotC(temp, trnsp=False, inv=True) # DAO.S = C.D.C^(-1) # add up the contributions for the different atoms state['BO'] = numpy.zeros([self.mos.num_at, self.mos.num_at]) for i in range(self.num_bas): iat = self.mos.basis_fcts[i].at_ind - 1 for j in range(self.num_bas): jat = self.mos.basis_fcts[j].at_ind - 1 state['BO'][iat, jat] += DS[i, j] * DS[j, i] QA = pop_ana.mullpop_ana().ret_pop(D, self.mos, DS) state['V_A'] = numpy.zeros([self.mos.num_at]) state['F_A'] = numpy.zeros([self.mos.num_at]) state['tBO'] = numpy.zeros([self.mos.num_at]) # direct valence for iat in range(self.mos.num_at): state['V_A'][iat] = 2 * QA[iat] - state['BO'][iat, iat] state['F_A'][iat] = state['V_A'][iat] for jat in range(self.mos.num_at): if jat != iat: state['F_A'][iat] -= state['BO'][iat, jat] state['tBO'][iat] += state['BO'][iat, jat] return state['BO']
def ret_BO(self, state): """ Return the bond order and compute some descriptors related to the bond order. """ if 'BO' in state: return state['BO'] try: D = state['sden'] except KeyError: return None print("Computation of the bond order matrix ...") temp = self.mos.CdotD(D, trnsp=False, inv=False) # C.DAO DS = self.mos.MdotC(temp, trnsp=False, inv=True) # DAO.S = C.D.C^(-1) # add up the contributions for the different atoms state['BO'] = numpy.zeros([self.mos.num_at, self.mos.num_at]) for i in range(self.num_bas): iat = self.mos.basis_fcts[i].at_ind - 1 for j in range(self.num_bas): jat = self.mos.basis_fcts[j].at_ind - 1 state['BO'][iat, jat] += DS[i, j] * DS[j, i] QA = pop_ana.mullpop_ana().ret_pop(D, self.mos, DS) state['V_A'] = numpy.zeros([self.mos.num_at]) state['F_A'] = numpy.zeros([self.mos.num_at]) state['tBO'] = numpy.zeros([self.mos.num_at]) # direct valence for iat in range(self.mos.num_at): state['V_A'][iat] = 2 * QA[iat] - state['BO'][iat, iat] state['F_A'][iat] = state['V_A'][iat] for jat in range(self.mos.num_at): if jat!=iat: state['F_A'][iat] -= state['BO'][iat, jat] state['tBO'][iat] += state['BO'][iat, jat] return state['BO']
def ret_general_pop(self, state, ana_type='mullpop', dens_type=''): """ Return the result of a general population analysis. """ if dens_type == '' or dens_type == 'state': dens_name = 'sden' mp_name = ana_type else: dens_name = '%s_den'%dens_type mp_name = '%s_%s'%(ana_type, dens_type) if mp_name in state: return state[mp_name] if not dens_name in state: return None if ana_type == 'mullpop': pana = pop_ana.mullpop_ana() else: raise error_handler.MsgError('Population analyis type not implmented: %s'%ana_type) state[mp_name] = pana.ret_pop(state[dens_name], self.mos) return state[mp_name]