def solve_mo1(nmrobj, mo_energy=None, mo_coeff=None, mo_occ=None, h1=None, s1=None, with_cphf=None): if with_cphf is None: with_cphf = nmrobj.cphf libxc = nmrobj._scf._numint.libxc with_cphf = with_cphf and libxc.is_hybrid_xc(nmrobj._scf.xc) return rhf_nmr.solve_mo1(nmrobj, mo_energy, mo_coeff, mo_occ, h1, s1, with_cphf)
def solve_mo1(nmrobj, mo_energy=None, mo_coeff=None, mo_occ=None, h1=None, s1=None, with_cphf=None): if with_cphf is None: with_cphf = nmrobj.cphf libxc = nmrobj._scf._numint.libxc with_cphf = with_cphf and libxc.is_hybrid_xc(nmrobj._scf.xc) return rhf_nmr.solve_mo1(nmrobj, mo_energy, mo_coeff, mo_occ, h1, s1, with_cphf)
def para(magobj, gauge_orig=None, h1=None, s1=None, with_cphf=None): '''Paramagnetic susceptibility tensor Kwargs: h1: (3,nmo,nocc) array First order Fock matrix in MO basis. s1: (3,nmo,nocc) array First order overlap matrix in MO basis. with_cphf : boolean or function(dm_mo) => v1_mo If a boolean value is given, the value determines whether CPHF equation will be solved or not. The induced potential will be generated by the function gen_vind. If a function is given, CPHF equation will be solved, and the given function is used to compute induced potential ''' log = logger.Logger(magobj.stdout, magobj.verbose) cput1 = (time.clock(), time.time()) mol = magobj.mol mf = magobj._scf mo_energy = mf.mo_energy mo_coeff = mf.mo_coeff mo_occ = mf.mo_occ occidx = mo_occ > 0 orbo = mo_coeff[:, occidx] if h1 is None: # Imaginary part of F10 dm0 = mf.make_rdm1(mo_coeff, mo_occ) h1 = lib.einsum('xpq,pi,qj->xij', magobj.get_fock(dm0, gauge_orig), mo_coeff.conj(), orbo) if s1 is None: # Imaginary part of S10 s1 = lib.einsum('xpq,pi,qj->xij', magobj.get_ovlp(mol, gauge_orig), mo_coeff.conj(), orbo) cput1 = log.timer('first order Fock matrix', *cput1) with_cphf = magobj.cphf mo1, mo_e1 = rhf_nmr.solve_mo1(magobj, mo_energy, mo_coeff, mo_occ, h1, s1, with_cphf) cput1 = logger.timer(magobj, 'solving mo1 eqn', *cput1) mag_para = numpy.einsum('yji,xji->xy', mo1, h1) mag_para -= numpy.einsum('yji,xji,i->xy', mo1, s1, mo_energy[occidx]) # + c.c. mag_para = mag_para + mag_para.conj() mag_para -= numpy.einsum('xij,yij->xy', s1[:, occidx], mo_e1) # *2 for double occupancy. mag_para *= 2 return -mag_para
def para(magobj, gauge_orig=None, h1=None, s1=None, with_cphf=None): '''Paramagnetic susceptibility tensor Kwargs: h1: (3,nmo,nocc) array First order Fock matrix in MO basis. s1: (3,nmo,nocc) array First order overlap matrix in MO basis. with_cphf : boolean or function(dm_mo) => v1_mo If a boolean value is given, the value determines whether CPHF equation will be solved or not. The induced potential will be generated by the function gen_vind. If a function is given, CPHF equation will be solved, and the given function is used to compute induced potential ''' log = logger.Logger(magobj.stdout, magobj.verbose) cput1 = (time.clock(), time.time()) mol = magobj.mol mf = magobj._scf mo_energy = mf.mo_energy mo_coeff = mf.mo_coeff mo_occ = mf.mo_occ occidx = mo_occ > 0 orbo = mo_coeff[:,occidx] if h1 is None: # Imaginary part of F10 dm0 = mf.make_rdm1(mo_coeff, mo_occ) h1 = lib.einsum('xpq,pi,qj->xij', magobj.get_fock(dm0, gauge_orig), mo_coeff.conj(), orbo) if s1 is None: # Imaginary part of S10 s1 = lib.einsum('xpq,pi,qj->xij', magobj.get_ovlp(mol, gauge_orig), mo_coeff.conj(), orbo) cput1 = log.timer('first order Fock matrix', *cput1) with_cphf = magobj.cphf mo1, mo_e1 = rhf_nmr.solve_mo1(magobj, mo_energy, mo_coeff, mo_occ, h1, s1, with_cphf) cput1 = logger.timer(magobj, 'solving mo1 eqn', *cput1) mag_para = numpy.einsum('yji,xji->xy', mo1, h1) mag_para-= numpy.einsum('yji,xji,i->xy', mo1, s1, mo_energy[occidx]) # + c.c. mag_para = mag_para + mag_para.conj() mag_para-= numpy.einsum('xij,yij->xy', s1[:,occidx], mo_e1) # *2 for double occupancy. mag_para *= 2 return -mag_para
def solve_mo1(nmrobj, mo_energy=None, mo_coeff=None, mo_occ=None, h1=None, s1=None, with_cphf=None): if with_cphf is None: with_cphf = nmrobj.cphf # vind for DHF for first order equations if with_cphf and not callable(with_cphf): mf = nmrobj._scf if mo_coeff is None: mo_coeff = mf.mo_coeff if mo_occ is None: mo_occ = mf.mo_occ with_cphf = gen_vind(mf, mo_coeff, mo_occ) return rhf_nmr.solve_mo1(nmrobj, mo_energy, mo_coeff, mo_occ, h1, s1, with_cphf)
def solve_mo1(nmrobj, mo_energy=None, mo_coeff=None, mo_occ=None, h1=None, s1=None, with_cphf=None): if with_cphf is None: with_cphf = nmrobj.cphf # vind for DHF for first order equations if with_cphf and not callable(with_cphf): mf = nmrobj._scf if mo_coeff is None: mo_coeff = mf.mo_coeff if mo_occ is None: mo_occ = mf.mo_occ with_cphf = gen_vind(mf, mo_coeff, mo_occ) return rhf_nmr.solve_mo1(nmrobj, mo_energy, mo_coeff, mo_occ, h1, s1, with_cphf)