def para(gobj, mo10, mo_coeff, mo_occ, qed_fac=1): mol = gobj.mol effspin = mol.spin * .5 muB = .5 # Bohr magneton #qed_fac = (nist.G_ELECTRON - 1) orboa = mo_coeff[0][:,mo_occ[0]>0] orbob = mo_coeff[1][:,mo_occ[1]>0] dm0a = numpy.dot(orboa, orboa.T) dm0b = numpy.dot(orbob, orbob.T) dm10a = [reduce(numpy.dot, (mo_coeff[0], x, orboa.T)) for x in mo10[0]] dm10b = [reduce(numpy.dot, (mo_coeff[1], x, orbob.T)) for x in mo10[1]] dm10a = numpy.asarray([x-x.T for x in dm10a]) dm10b = numpy.asarray([x-x.T for x in dm10b]) hso1e = uhf_g.make_h01_soc1e(gobj, mo_coeff, mo_occ, qed_fac) gpara1e =-numpy.einsum('xji,yij->xy', dm10a, hso1e) gpara1e+= numpy.einsum('xji,yij->xy', dm10b, hso1e) gpara1e *= 1./effspin / muB _write(gobj, align(gpara1e)[0], 'SOC(1e)/OZ') if gobj.para_soc2e: gpara2e = gobj.make_para_soc2e((dm0a,dm0b), (dm10a,dm10b), qed_fac) _write(gobj, align(gpara2e)[0], 'SOC(2e)/OZ') else: gpara2e = 0 gpara = gpara1e + gpara2e return gpara