def kernel(self, mo1=None): if len(self.nuc_pair) == 0: return cput0 = (time.clock(), time.time()) self.check_sanity() self.dump_flags() mol = self.mol dm0 = self._scf.make_rdm1() mo_coeff = self._scf.mo_coeff mo_occ = self._scf.mo_occ ssc_dia = self.make_dso(mol, dm0) if mo1 is None: mo1 = self.mo10 = self.solve_mo1()[0] ssc_pso = self.make_pso(mol, mo1, mo_coeff, mo_occ) e11 = ssc_dia + ssc_pso if self.with_fcsd: ssc_fcsd = self.make_fcsd(self.nuc_pair) e11 += ssc_fcsd elif self.with_fc: ssc_fc = self.make_fc(self.nuc_pair) e11 += ssc_fc logger.timer(self, 'spin-spin coupling', *cput0) if self.verbose > logger.QUIET: nuc_mag = .5 * (nist.E_MASS / nist.PROTON_MASS) # e*hbar/2m au2Hz = nist.HARTREE2J / nist.PLANCK #logger.debug('Unit AU -> Hz %s', au2Hz*nuc_mag**2) iso_ssc = au2Hz * nuc_mag**2 * numpy.einsum('kii->k', e11) / 3 natm = mol.natm ktensor = numpy.zeros((natm, natm)) for k, (i, j) in enumerate(self.nuc_pair): ktensor[i, j] = ktensor[j, i] = iso_ssc[k] if self.verbose >= logger.DEBUG: _write(self.stdout, ssc_dia[k]+ssc_para[k], '\nSSC E11 between %d %s and %d %s' \ % (i, self.mol.atom_symbol(i), j, self.mol.atom_symbol(j))) # _write(self.stdout, ssc_dia [k], 'dia-magnetism') # _write(self.stdout, ssc_para[k], 'para-magnetism') gyro = [ get_nuc_g_factor(mol.atom_symbol(ia)) for ia in range(natm) ] jtensor = numpy.einsum('ij,i,j->ij', ktensor, gyro, gyro) label = [ '%2d %-2s' % (ia, mol.atom_symbol(ia)) for ia in range(natm) ] logger.note(self, 'Reduced spin-spin coupling constant K (Hz)') tools.dump_mat.dump_tri(self.stdout, ktensor, label) logger.info(self, '\nNuclear g factor %s', gyro) logger.note(self, 'Spin-spin coupling constant J (Hz)') tools.dump_mat.dump_tri(self.stdout, jtensor, label) return e11
def kernel(self, mo1=None): if len(self.nuc_pair) == 0: return cput0 = (time.clock(), time.time()) self.check_sanity() self.dump_flags() mol = self.mol dm0 = self._scf.make_rdm1() mo_coeff = self._scf.mo_coeff mo_occ = self._scf.mo_occ ssc_dia = self.make_dso(mol, dm0) if mo1 is None: mo1 = self.mo10 = self.solve_mo1()[0] ssc_pso = self.make_pso(mol, mo1, mo_coeff, mo_occ) e11 = ssc_dia + ssc_pso if self.with_fcsd: ssc_fcsd = self.make_fcsd(self.nuc_pair) e11 += ssc_fcsd elif self.with_fc: ssc_fc = self.make_fc(self.nuc_pair) e11 += ssc_fc logger.timer(self, 'spin-spin coupling', *cput0) if self.verbose > logger.QUIET: nuc_mag = .5 * (nist.E_MASS/nist.PROTON_MASS) # e*hbar/2m au2Hz = nist.HARTREE2J / nist.PLANCK #logger.debug('Unit AU -> Hz %s', au2Hz*nuc_mag**2) iso_ssc = au2Hz * nuc_mag ** 2 * numpy.einsum('kii->k', e11) / 3 natm = mol.natm ktensor = numpy.zeros((natm,natm)) for k, (i, j) in enumerate(self.nuc_pair): ktensor[i,j] = ktensor[j,i] = iso_ssc[k] if self.verbose >= logger.DEBUG: _write(self.stdout, ssc_dia[k]+ssc_para[k], '\nSSC E11 between %d %s and %d %s' \ % (i, self.mol.atom_symbol(i), j, self.mol.atom_symbol(j))) # _write(self.stdout, ssc_dia [k], 'dia-magnetism') # _write(self.stdout, ssc_para[k], 'para-magnetism') gyro = rhf_ssc._atom_gyro_list(mol) jtensor = numpy.einsum('ij,i,j->ij', ktensor, gyro, gyro) label = ['%2d %-2s'%(ia, mol.atom_symbol(ia)) for ia in range(natm)] logger.note(self, 'Reduced spin-spin coupling constant K (Hz)') tools.dump_mat.dump_tri(self.stdout, ktensor, label) logger.info(self, '\nNuclear g factor %s', gyro) logger.note(self, 'Spin-spin coupling constant J (Hz)') tools.dump_mat.dump_tri(self.stdout, jtensor, label) return e11