示例#1
0
    def _finalize(self):
        uhf.UHF._finalize(self)

        ea = numpy.hstack(self.mo_energy[0])
        eb = numpy.hstack(self.mo_energy[1])
        # Using mergesort because it is stable. We don't want to change the
        # ordering of the symmetry labels when two orbitals are degenerated.
        oa_sort = numpy.argsort(ea[self.mo_occ[0]>0 ].round(9), kind='mergesort')
        va_sort = numpy.argsort(ea[self.mo_occ[0]==0].round(9), kind='mergesort')
        ob_sort = numpy.argsort(eb[self.mo_occ[1]>0 ].round(9), kind='mergesort')
        vb_sort = numpy.argsort(eb[self.mo_occ[1]==0].round(9), kind='mergesort')
        idxa = numpy.arange(ea.size)
        idxa = numpy.hstack((idxa[self.mo_occ[0]> 0][oa_sort],
                             idxa[self.mo_occ[0]==0][va_sort]))
        idxb = numpy.arange(eb.size)
        idxb = numpy.hstack((idxb[self.mo_occ[1]> 0][ob_sort],
                             idxb[self.mo_occ[1]==0][vb_sort]))
        self.mo_energy = (ea[idxa], eb[idxb])
        orbsyma, orbsymb = get_orbsym(self.mol, self.mo_coeff)
        self.mo_coeff = (lib.tag_array(self.mo_coeff[0][:,idxa], orbsym=orbsyma[idxa]),
                         lib.tag_array(self.mo_coeff[1][:,idxb], orbsym=orbsymb[idxb]))
        self.mo_occ = (self.mo_occ[0][idxa], self.mo_occ[1][idxb])
        if self.chkfile:
            chkfile.dump_scf(self.mol, self.chkfile, self.e_tot, self.mo_energy,
                             self.mo_coeff, self.mo_occ, overwrite_mol=False)
        return self
示例#2
0
文件: hf_symm.py 项目: xlzan/pyscf
    def _finalize(self):
        rohf.ROHF._finalize(self)

        # sort MOs wrt orbital energies, it should be done last.
        c_sort = numpy.argsort(self.mo_energy[self.mo_occ == 2].round(9),
                               kind='mergesort')
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ == 1].round(9),
                               kind='mergesort')
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ == 0].round(9),
                               kind='mergesort')
        idx = numpy.arange(self.mo_energy.size)
        idx = numpy.hstack(
            (idx[self.mo_occ == 2][c_sort], idx[self.mo_occ == 1][o_sort],
             idx[self.mo_occ == 0][v_sort]))
        if hasattr(self.mo_energy, 'mo_ea'):
            mo_ea = self.mo_energy.mo_ea[idx]
            mo_eb = self.mo_energy.mo_eb[idx]
            self.mo_energy = lib.tag_array(self.mo_energy[idx],
                                           mo_ea=mo_ea,
                                           mo_eb=mo_eb)
        else:
            self.mo_energy = self.mo_energy[idx]
        orbsym = get_orbsym(self.mol, self.mo_coeff)
        self.mo_coeff = lib.tag_array(self.mo_coeff[:, idx],
                                      orbsym=orbsym[idx])
        self.mo_occ = self.mo_occ[idx]
        if self.chkfile:
            chkfile.dump_scf(self.mol,
                             self.chkfile,
                             self.e_tot,
                             self.mo_energy,
                             self.mo_coeff,
                             self.mo_occ,
                             overwrite_mol=False)
        return self
示例#3
0
    def _finalize_(self):
        uhf.UHF._finalize_(self)

        ea = numpy.hstack(self.mo_energy[0])
        eb = numpy.hstack(self.mo_energy[0])
        oa_sort = numpy.argsort(ea[self.mo_occ[0]>0])
        va_sort = numpy.argsort(ea[self.mo_occ[0]==0])
        ob_sort = numpy.argsort(eb[self.mo_occ[1]>0])
        vb_sort = numpy.argsort(eb[self.mo_occ[1]==0])
        self.mo_energy = (numpy.hstack((ea[self.mo_occ[0]>0 ][oa_sort], \
                                        ea[self.mo_occ[0]==0][va_sort])), \
                          numpy.hstack((eb[self.mo_occ[1]>0 ][ob_sort], \
                                        eb[self.mo_occ[1]==0][vb_sort])))
        ca = self.mo_coeff[0]
        cb = self.mo_coeff[1]
        self.mo_coeff = (numpy.hstack((ca[:,self.mo_occ[0]>0 ][:,oa_sort], \
                                       ca[:,self.mo_occ[0]==0][:,va_sort])), \
                         numpy.hstack((cb[:,self.mo_occ[1]>0 ][:,ob_sort], \
                                       cb[:,self.mo_occ[1]==0][:,vb_sort])))
        nocc_a = int(self.mo_occ[0].sum())
        nocc_b = int(self.mo_occ[1].sum())
        self.mo_occ[0][:nocc_a] = 1
        self.mo_occ[0][nocc_a:] = 0
        self.mo_occ[1][:nocc_b] = 1
        self.mo_occ[1][nocc_b:] = 0
        if self.chkfile:
            chkfile.dump_scf(self.mol, self.chkfile,
                             self.hf_energy, self.mo_energy,
                             self.mo_coeff, self.mo_occ)
示例#4
0
    def _finalize(self):
        uhf.UHF._finalize(self)

        ea = numpy.hstack(self.mo_energy[0])
        eb = numpy.hstack(self.mo_energy[1])
        # Using mergesort because it is stable. We don't want to change the
        # ordering of the symmetry labels when two orbitals are degenerated.
        oa_sort = numpy.argsort(ea[self.mo_occ[0]>0 ].round(9), kind='mergesort')
        va_sort = numpy.argsort(ea[self.mo_occ[0]==0].round(9), kind='mergesort')
        ob_sort = numpy.argsort(eb[self.mo_occ[1]>0 ].round(9), kind='mergesort')
        vb_sort = numpy.argsort(eb[self.mo_occ[1]==0].round(9), kind='mergesort')
        idxa = numpy.arange(ea.size)
        idxa = numpy.hstack((idxa[self.mo_occ[0]> 0][oa_sort],
                             idxa[self.mo_occ[0]==0][va_sort]))
        idxb = numpy.arange(eb.size)
        idxb = numpy.hstack((idxb[self.mo_occ[1]> 0][ob_sort],
                             idxb[self.mo_occ[1]==0][vb_sort]))
        self.mo_energy = (ea[idxa], eb[idxb])
        orbsyma, orbsymb = get_orbsym(self.mol, self.mo_coeff)
        self.mo_coeff = (lib.tag_array(self.mo_coeff[0][:,idxa], orbsym=orbsyma[idxa]),
                         lib.tag_array(self.mo_coeff[1][:,idxb], orbsym=orbsymb[idxb]))
        self.mo_occ = (self.mo_occ[0][idxa], self.mo_occ[1][idxb])
        if self.chkfile:
            chkfile.dump_scf(self.mol, self.chkfile, self.e_tot, self.mo_energy,
                             self.mo_coeff, self.mo_occ, overwrite_mol=False)
        return self
示例#5
0
    def _finalize(self):
        ghf.GHF._finalize(self)

        # Using mergesort because it is stable. We don't want to change the
        # ordering of the symmetry labels when two orbitals are degenerated.
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ > 0].round(9),
                               kind='mergesort')
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ == 0].round(9),
                               kind='mergesort')
        orbsym = get_orbsym(self.mol, self.mo_coeff)
        self.mo_energy = numpy.hstack(
            (self.mo_energy[self.mo_occ > 0][o_sort],
             self.mo_energy[self.mo_occ == 0][v_sort]))
        self.mo_coeff = numpy.hstack(
            (self.mo_coeff[:, self.mo_occ > 0].take(o_sort, axis=1),
             self.mo_coeff[:, self.mo_occ == 0].take(v_sort, axis=1)))
        orbsym = numpy.hstack((orbsym[self.mo_occ > 0][o_sort],
                               orbsym[self.mo_occ == 0][v_sort]))
        self.mo_coeff = lib.tag_array(self.mo_coeff, orbsym=orbsym)
        nocc = len(o_sort)
        self.mo_occ[:nocc] = 1
        self.mo_occ[nocc:] = 0
        if self.chkfile:
            chkfile.dump_scf(self.mol,
                             self.chkfile,
                             self.e_tot,
                             self.mo_energy,
                             self.mo_coeff,
                             self.mo_occ,
                             overwrite_mol=False)
        return self
示例#6
0
    def _finalize(self):
        hf.RHF._finalize(self)

        # sort MOs wrt orbital energies, it should be done last.
        # Using mergesort because it is stable. We don't want to change the
        # ordering of the symmetry labels when two orbitals are degenerated.
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ > 0].round(9),
                               kind='mergesort')
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ == 0].round(9),
                               kind='mergesort')
        idx = numpy.arange(self.mo_energy.size)
        idx = numpy.hstack(
            (idx[self.mo_occ > 0][o_sort], idx[self.mo_occ == 0][v_sort]))
        self.mo_energy = self.mo_energy[idx]
        orbsym = get_orbsym(self.mol, self.mo_coeff)
        self.mo_coeff = lib.tag_array(self.mo_coeff[:, idx],
                                      orbsym=orbsym[idx])
        self.mo_occ = self.mo_occ[idx]
        if self.chkfile:
            chkfile.dump_scf(self.mol,
                             self.chkfile,
                             self.e_tot,
                             self.mo_energy,
                             self.mo_coeff,
                             self.mo_occ,
                             overwrite_mol=False)
        return self
示例#7
0
文件: uhf_symm.py 项目: pengdl/pyscf
    def _finalize(self):
        uhf.UHF._finalize(self)

        ea = numpy.hstack(self.mo_energy[0])
        eb = numpy.hstack(self.mo_energy[0])
        oa_sort = numpy.argsort(ea[self.mo_occ[0]>0])
        va_sort = numpy.argsort(ea[self.mo_occ[0]==0])
        ob_sort = numpy.argsort(eb[self.mo_occ[1]>0])
        vb_sort = numpy.argsort(eb[self.mo_occ[1]==0])
        self.mo_energy = (numpy.hstack((ea[self.mo_occ[0]>0 ][oa_sort],
                                        ea[self.mo_occ[0]==0][va_sort])),
                          numpy.hstack((eb[self.mo_occ[1]>0 ][ob_sort],
                                        eb[self.mo_occ[1]==0][vb_sort])))
        ca = self.mo_coeff[0]
        cb = self.mo_coeff[1]
        self.mo_coeff = (numpy.hstack((ca[:,self.mo_occ[0]>0 ].take(oa_sort, axis=1),
                                       ca[:,self.mo_occ[0]==0].take(va_sort, axis=1))),
                         numpy.hstack((cb[:,self.mo_occ[1]>0 ].take(ob_sort, axis=1),
                                       cb[:,self.mo_occ[1]==0].take(vb_sort, axis=1))))
        nocc_a = int(self.mo_occ[0].sum())
        nocc_b = int(self.mo_occ[1].sum())
        self.mo_occ[0][:nocc_a] = 1
        self.mo_occ[0][nocc_a:] = 0
        self.mo_occ[1][:nocc_b] = 1
        self.mo_occ[1][nocc_b:] = 0
        if self.chkfile:
            chkfile.dump_scf(self.mol, self.chkfile, self.e_tot, self.mo_energy,
                             self.mo_coeff, self.mo_occ, overwrite_mol=True)
        return self
示例#8
0
    def _finalize(self):
        uhf.UHF._finalize(self)

        ea = numpy.hstack(self.mo_energy[0])
        eb = numpy.hstack(self.mo_energy[1])
        oa_sort = numpy.argsort(ea[self.mo_occ[0] > 0].round(9))
        va_sort = numpy.argsort(ea[self.mo_occ[0] == 0].round(9))
        ob_sort = numpy.argsort(eb[self.mo_occ[1] > 0].round(9))
        vb_sort = numpy.argsort(eb[self.mo_occ[1] == 0].round(9))
        idxa = numpy.arange(ea.size)
        idxa = numpy.hstack((idxa[self.mo_occ[0] > 0][oa_sort],
                             idxa[self.mo_occ[0] == 0][va_sort]))
        idxb = numpy.arange(eb.size)
        idxb = numpy.hstack((idxb[self.mo_occ[1] > 0][ob_sort],
                             idxb[self.mo_occ[1] == 0][vb_sort]))
        self.mo_energy = (ea[idxa], eb[idxb])
        orbsyma, orbsymb = get_orbsym(self.mol, self.mo_coeff)
        self.mo_coeff = (lib.tag_array(self.mo_coeff[0][:, idxa],
                                       orbsym=orbsyma[idxa]),
                         lib.tag_array(self.mo_coeff[1][:, idxb],
                                       orbsym=orbsymb[idxb]))
        self.mo_occ = (self.mo_occ[0][idxa], self.mo_occ[1][idxb])
        if self.chkfile:
            chkfile.dump_scf(self.mol,
                             self.chkfile,
                             self.e_tot,
                             self.mo_energy,
                             self.mo_coeff,
                             self.mo_occ,
                             overwrite_mol=False)
        return self
示例#9
0
文件: hf.py 项目: armunoz/pyscf
 def dump_chk(self, envs):
     if self.chkfile:
         chkfile.dump_scf(self.mol, self.chkfile,
                          envs['e_tot'], envs['mo_energy'],
                          envs['mo_coeff'], envs['mo_occ'],
                          overwrite_mol=False)
     return self
示例#10
0
文件: ghf_symm.py 项目: xlzan/pyscf
    def _finalize(self):
        ghf.GHF._finalize(self)

        o_sort = numpy.argsort(self.mo_energy[self.mo_occ > 0].round(9),
                               kind='mergesort')
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ == 0].round(9),
                               kind='mergesort')
        orbsym = get_orbsym(self.mol, self.mo_coeff)
        self.mo_energy = numpy.hstack(
            (self.mo_energy[self.mo_occ > 0][o_sort],
             self.mo_energy[self.mo_occ == 0][v_sort]))
        self.mo_coeff = numpy.hstack(
            (self.mo_coeff[:, self.mo_occ > 0].take(o_sort, axis=1),
             self.mo_coeff[:, self.mo_occ == 0].take(v_sort, axis=1)))
        orbsym = numpy.hstack((orbsym[self.mo_occ > 0][o_sort],
                               orbsym[self.mo_occ == 0][v_sort]))
        self.mo_coeff = lib.tag_array(self.mo_coeff, orbsym=orbsym)
        nocc = len(o_sort)
        self.mo_occ[:nocc] = 1
        self.mo_occ[nocc:] = 0
        if self.chkfile:
            chkfile.dump_scf(self.mol,
                             self.chkfile,
                             self.e_tot,
                             self.mo_energy,
                             self.mo_coeff,
                             self.mo_occ,
                             overwrite_mol=False)
        return self
示例#11
0
文件: hf_symm.py 项目: rvexiau/pyscf
    def _finalize(self):
        rohf.ROHF._finalize(self)

        # sort MOs wrt orbital energies, it should be done last.
        # Using mergesort because it is stable. We don't want to change the
        # ordering of the symmetry labels when two orbitals are degenerated.
        c_sort = numpy.argsort(self.mo_energy[self.mo_occ==2].round(9), kind='mergesort')
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ==1].round(9), kind='mergesort')
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ==0].round(9), kind='mergesort')
        idx = numpy.arange(self.mo_energy.size)
        idx = numpy.hstack((idx[self.mo_occ==2][c_sort],
                            idx[self.mo_occ==1][o_sort],
                            idx[self.mo_occ==0][v_sort]))
        if getattr(self.mo_energy, 'mo_ea', None) is not None:
            mo_ea = self.mo_energy.mo_ea[idx]
            mo_eb = self.mo_energy.mo_eb[idx]
            self.mo_energy = lib.tag_array(self.mo_energy[idx],
                                           mo_ea=mo_ea, mo_eb=mo_eb)
        else:
            self.mo_energy = self.mo_energy[idx]
        orbsym = self.get_orbsym(self.mo_coeff, self.get_ovlp())
        self.mo_coeff = lib.tag_array(self.mo_coeff[:,idx], orbsym=orbsym[idx])
        self.mo_occ = self.mo_occ[idx]
        if self.chkfile:
            chkfile.dump_scf(self.mol, self.chkfile, self.e_tot, self.mo_energy,
                             self.mo_coeff, self.mo_occ, overwrite_mol=False)
        return self
示例#12
0
    def _finalize(self):
        rohf.ROHF._finalize(self)

        # sort MOs wrt orbital energies, it should be done last.
        c_sort = numpy.argsort(self.mo_energy[self.mo_occ == 2].round(9))
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ == 1].round(9))
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ == 0].round(9))
        self.mo_energy = numpy.hstack(
            (self.mo_energy[self.mo_occ == 2][c_sort],
             self.mo_energy[self.mo_occ == 1][o_sort],
             self.mo_energy[self.mo_occ == 0][v_sort]))
        self.mo_coeff = numpy.hstack(
            (self.mo_coeff[:, self.mo_occ == 2].take(c_sort, axis=1),
             self.mo_coeff[:, self.mo_occ == 1].take(o_sort, axis=1),
             self.mo_coeff[:, self.mo_occ == 0].take(v_sort, axis=1)))
        ncore = len(c_sort)
        nocc = ncore + len(o_sort)
        self.mo_occ[:ncore] = 2
        self.mo_occ[ncore:nocc] = 1
        self.mo_occ[nocc:] = 0
        if self.chkfile:
            chkfile.dump_scf(self.mol,
                             self.chkfile,
                             self.e_tot,
                             self.mo_energy,
                             self.mo_coeff,
                             self.mo_occ,
                             overwrite_mol=False)
        return self
示例#13
0
文件: hf_symm.py 项目: xlzan/pyscf
    def _finalize(self):
        hf.RHF._finalize(self)

        # sort MOs wrt orbital energies, it should be done last.
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ > 0].round(9),
                               kind='mergesort')
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ == 0].round(9),
                               kind='mergesort')
        idx = numpy.arange(self.mo_energy.size)
        idx = numpy.hstack(
            (idx[self.mo_occ > 0][o_sort], idx[self.mo_occ == 0][v_sort]))
        self.mo_energy = self.mo_energy[idx]
        orbsym = get_orbsym(self.mol, self.mo_coeff)
        self.mo_coeff = lib.tag_array(self.mo_coeff[:, idx],
                                      orbsym=orbsym[idx])
        self.mo_occ = self.mo_occ[idx]
        if self.chkfile:
            chkfile.dump_scf(self.mol,
                             self.chkfile,
                             self.e_tot,
                             self.mo_energy,
                             self.mo_coeff,
                             self.mo_occ,
                             overwrite_mol=False)
        return self
示例#14
0
    def _finalize(self):
        uhf.UHF._finalize(self)

        ea = numpy.hstack(self.mo_energy[0])
        eb = numpy.hstack(self.mo_energy[1])
        oa_sort = numpy.argsort(ea[self.mo_occ[0]>0 ].round(9))
        va_sort = numpy.argsort(ea[self.mo_occ[0]==0].round(9))
        ob_sort = numpy.argsort(eb[self.mo_occ[1]>0 ].round(9))
        vb_sort = numpy.argsort(eb[self.mo_occ[1]==0].round(9))
        self.mo_energy = (numpy.hstack((ea[self.mo_occ[0]>0 ][oa_sort],
                                        ea[self.mo_occ[0]==0][va_sort])),
                          numpy.hstack((eb[self.mo_occ[1]>0 ][ob_sort],
                                        eb[self.mo_occ[1]==0][vb_sort])))
        ca = self.mo_coeff[0]
        cb = self.mo_coeff[1]
        self.mo_coeff = (numpy.hstack((ca[:,self.mo_occ[0]>0 ].take(oa_sort, axis=1),
                                       ca[:,self.mo_occ[0]==0].take(va_sort, axis=1))),
                         numpy.hstack((cb[:,self.mo_occ[1]>0 ].take(ob_sort, axis=1),
                                       cb[:,self.mo_occ[1]==0].take(vb_sort, axis=1))))
        nocc_a = int(self.mo_occ[0].sum())
        nocc_b = int(self.mo_occ[1].sum())
        self.mo_occ[0][:nocc_a] = 1
        self.mo_occ[0][nocc_a:] = 0
        self.mo_occ[1][:nocc_b] = 1
        self.mo_occ[1][nocc_b:] = 0
        if self.chkfile:
            chkfile.dump_scf(self.mol, self.chkfile, self.e_tot, self.mo_energy,
                             self.mo_coeff, self.mo_occ, overwrite_mol=True)
        return self
示例#15
0
def _finalize(self):
    if isinstance(self, rohf.ROHF):
        rohf.ROHF._finalize(self)
    elif isinstance(self, hf.RHF):
        hf.RHF._finalize(self)

    if (self.mol.groupname in ('Dooh', 'Coov')):
        self.partner_orbs = self.get_partner_orbs()
    # sort MOs wrt orbital energies, it should be done last.
    # Using mergesort because it is stable. We don't want to change the
    # ordering of the symmetry labels when two orbitals are degenerated.

    if isinstance(self, rohf.ROHF):
        c_sort = numpy.argsort(self.mo_energy[self.mo_occ==2].round(9), kind='mergesort')
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ==1].round(9), kind='mergesort')
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ==0].round(9), kind='mergesort')
        idx = numpy.arange(self.mo_energy.size)
        idx = numpy.hstack((idx[self.mo_occ==2][c_sort],
                            idx[self.mo_occ==1][o_sort],
                            idx[self.mo_occ==0][v_sort]))
        if hasattr(self.mo_energy, 'mo_ea'):
            mo_ea = self.mo_energy.mo_ea[idx]
            mo_eb = self.mo_energy.mo_eb[idx]
            self.mo_energy = lib.tag_array(self.mo_energy[idx],
                                           mo_ea=mo_ea, mo_eb=mo_eb)
        else:
            self.mo_energy = self.mo_energy[idx]
    elif isinstance(self, hf.RHF):
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ> 0].round(9), kind='mergesort')
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ==0].round(9), kind='mergesort')
        idx = numpy.arange(self.mo_energy.size)
        idx = numpy.hstack((idx[self.mo_occ> 0][o_sort],
                            idx[self.mo_occ==0][v_sort]))
        self.mo_energy = self.mo_energy[idx]

    orbsym = hf_symm.get_orbsym(self.mol, self.mo_coeff)
    self.mo_coeff = lib.tag_array(self.mo_coeff[:,idx], orbsym=orbsym[idx])
    self.mo_occ = self.mo_occ[idx]

    if hasattr(self, 'partner_orbs'):
        idx_inv = numpy.argsort(idx)
        self.partner_orbs = [idx_inv[orb] for orb in self.partner_orbs[idx]]

    if self.chkfile:
        chkfile.dump_scf(self.mol, self.chkfile, self.e_tot, self.mo_energy,
                         self.mo_coeff, self.mo_occ, overwrite_mol=False)
    return self
示例#16
0
文件: hf_symm.py 项目: berquist/pyscf
    def _finalize(self):
        hf.RHF._finalize(self)

        # sort MOs wrt orbital energies, it should be done last.
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ>0 ].round(9))
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ==0].round(9))
        self.mo_energy = numpy.hstack((self.mo_energy[self.mo_occ>0][o_sort],
                                       self.mo_energy[self.mo_occ==0][v_sort]))
        self.mo_coeff = numpy.hstack((self.mo_coeff[:,self.mo_occ>0].take(o_sort, axis=1),
                                      self.mo_coeff[:,self.mo_occ==0].take(v_sort, axis=1)))
        nocc = len(o_sort)
        self.mo_occ[:nocc] = 2
        self.mo_occ[nocc:] = 0
        if self.chkfile:
            chkfile.dump_scf(self.mol, self.chkfile, self.e_tot, self.mo_energy,
                             self.mo_coeff, self.mo_occ, overwrite_mol=False)
        return self
示例#17
0
文件: hf_symm.py 项目: raybrad/pyscf
    def _finalize_(self):
        hf.RHF._finalize_(self)

        # sort MOs wrt orbital energies, it should be done last.
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ>0])
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ==0])
        self.mo_energy = numpy.hstack((self.mo_energy[self.mo_occ>0][o_sort], \
                                       self.mo_energy[self.mo_occ==0][v_sort]))
        self.mo_coeff = numpy.hstack((self.mo_coeff[:,self.mo_occ>0][:,o_sort], \
                                      self.mo_coeff[:,self.mo_occ==0][:,v_sort]))
        nocc = len(o_sort)
        self.mo_occ[:nocc] = 2
        self.mo_occ[nocc:] = 0
        if self.chkfile:
            chkfile.dump_scf(self.mol, self.chkfile,
                             self.e_tot, self.mo_energy,
                             self.mo_coeff, self.mo_occ)
示例#18
0
文件: hf_symm.py 项目: pulkin/pyscf
    def _finalize(self):
        hf.RHF._finalize(self)

        # sort MOs wrt orbital energies, it should be done last.
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ> 0].round(9))
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ==0].round(9))
        orbsym = get_orbsym(self.mol, self.mo_coeff)
        self.mo_energy = numpy.hstack((self.mo_energy[self.mo_occ> 0][o_sort],
                                       self.mo_energy[self.mo_occ==0][v_sort]))
        self.mo_coeff = numpy.hstack((self.mo_coeff[:,self.mo_occ> 0].take(o_sort, axis=1),
                                      self.mo_coeff[:,self.mo_occ==0].take(v_sort, axis=1)))
        orbsym = numpy.hstack((orbsym[self.mo_occ> 0][o_sort],
                               orbsym[self.mo_occ==0][v_sort]))
        self.mo_coeff = attach_orbsym(self.mo_coeff, orbsym)
        nocc = len(o_sort)
        self.mo_occ[:nocc] = 2
        self.mo_occ[nocc:] = 0
        if self.chkfile:
            chkfile.dump_scf(self.mol, self.chkfile, self.e_tot, self.mo_energy,
                             self.mo_coeff, self.mo_occ, overwrite_mol=False)
        return self
示例#19
0
    def _finalize_(self):
        rohf.ROHF._finalize_(self)

        # sort MOs wrt orbital energies, it should be done last.
        c_sort = numpy.argsort(self.mo_energy[self.mo_occ==2])
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ==1])
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ==0])
        self.mo_energy = numpy.hstack((self.mo_energy[self.mo_occ==2][c_sort],
                                       self.mo_energy[self.mo_occ==1][o_sort],
                                       self.mo_energy[self.mo_occ==0][v_sort]))
        self.mo_coeff = numpy.hstack((self.mo_coeff[:,self.mo_occ==2][:,c_sort],
                                      self.mo_coeff[:,self.mo_occ==1][:,o_sort],
                                      self.mo_coeff[:,self.mo_occ==0][:,v_sort]))
        ncore = len(c_sort)
        nocc = ncore + len(o_sort)
        self.mo_occ[:ncore] = 2
        self.mo_occ[ncore:nocc] = 1
        self.mo_occ[nocc:] = 0
        if self.chkfile:
            chkfile.dump_scf(self.mol, self.chkfile,
                             self.hf_energy, self.mo_energy,
                             self.mo_coeff, self.mo_occ)
示例#20
0
文件: hf_symm.py 项目: v1j4y/pyscf
    def _finalize_(self):
        rohf.ROHF._finalize_(self)

        # sort MOs wrt orbital energies, it should be done last.
        c_sort = numpy.argsort(self.mo_energy[self.mo_occ==2])
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ==1])
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ==0])
        self.mo_energy = numpy.hstack((self.mo_energy[self.mo_occ==2][c_sort],
                                       self.mo_energy[self.mo_occ==1][o_sort],
                                       self.mo_energy[self.mo_occ==0][v_sort]))
        self.mo_coeff = numpy.hstack((self.mo_coeff[:,self.mo_occ==2].take(c_sort, axis=1),
                                      self.mo_coeff[:,self.mo_occ==1].take(o_sort, axis=1),
                                      self.mo_coeff[:,self.mo_occ==0].take(v_sort, axis=1)))
        ncore = len(c_sort)
        nocc = ncore + len(o_sort)
        self.mo_occ[:ncore] = 2
        self.mo_occ[ncore:nocc] = 1
        self.mo_occ[nocc:] = 0
        if self.chkfile:
            chkfile.dump_scf(self.mol, self.chkfile, self.e_tot, self.mo_energy,
                             self.mo_coeff, self.mo_occ, overwrite_mol=False)
        return self
示例#21
0
    def _finalize(self):
        ghf.GHF._finalize(self)

        # Using mergesort because it is stable. We don't want to change the
        # ordering of the symmetry labels when two orbitals are degenerated.
        o_sort = numpy.argsort(self.mo_energy[self.mo_occ> 0].round(9), kind='mergesort')
        v_sort = numpy.argsort(self.mo_energy[self.mo_occ==0].round(9), kind='mergesort')
        orbsym = get_orbsym(self.mol, self.mo_coeff)
        self.mo_energy = numpy.hstack((self.mo_energy[self.mo_occ> 0][o_sort],
                                       self.mo_energy[self.mo_occ==0][v_sort]))
        self.mo_coeff = numpy.hstack((self.mo_coeff[:,self.mo_occ> 0].take(o_sort, axis=1),
                                      self.mo_coeff[:,self.mo_occ==0].take(v_sort, axis=1)))
        orbsym = numpy.hstack((orbsym[self.mo_occ> 0][o_sort],
                               orbsym[self.mo_occ==0][v_sort]))
        self.mo_coeff = lib.tag_array(self.mo_coeff, orbsym=orbsym)
        nocc = len(o_sort)
        self.mo_occ[:nocc] = 1
        self.mo_occ[nocc:] = 0
        if self.chkfile:
            chkfile.dump_scf(self.mol, self.chkfile, self.e_tot, self.mo_energy,
                             self.mo_coeff, self.mo_occ, overwrite_mol=False)
        return self
示例#22
0
文件: hf.py 项目: diradical/pyscf
 def dump_chk(self, envs):
     if self.chkfile:
         chkfile.dump_scf(self.mol, self.chkfile,
                          envs['hf_energy'], envs['mo_energy'],
                          envs['mo_coeff'], envs['mo_occ'])