def from_ucisdvec(civec, nocc, orbspin): '''Convert the (spin-separated) CISD coefficient vector to GCISD coefficient vector''' nmoa = numpy.count_nonzero(orbspin == 0) nmob = numpy.count_nonzero(orbspin == 1) if isinstance(nocc, int): nocca = numpy.count_nonzero(orbspin[:nocc] == 0) noccb = numpy.count_nonzero(orbspin[:nocc] == 1) else: nocca, noccb = nocc nvira, nvirb = nmoa-nocca, nmob-noccb if civec.size == nocca*nvira + (nocca*nvira)**2 + 1: # RCISD c0, c1, c2 = cisd.cisdvec_to_amplitudes(civec, nmoa, nocca) else: # UCISD c0, c1, c2 = ucisd.cisdvec_to_amplitudes(civec, (nmoa,nmob), (nocca,noccb)) c1 = spatial2spin(c1, orbspin) c2 = spatial2spin(c2, orbspin) return amplitudes_to_cisdvec(c0, c1, c2)