Exemple #1
0
def flosic_energy_elec(mf, dm=None, h1e=None, vhf=None):
    # Get the nuclei potential.
    h1e = mf.get_hcore()

    # This is the nuclei-electron interaction.
    e_nuc = np.einsum('ij,ji', h1e, dm[0]) + np.einsum('ij,ji', h1e, dm[1])

    try:
        # Every other DFT cycle: electronic energy calculated as sum of the contributions.
        e_correction = vhf.__dict__['ecoul'] + vhf.__dict__[
            'exc'] + vhf.__dict__['esic']
        e_sic = (e_correction, vhf.__dict__['ecoul'])

        # This part looks odd, but it is correct.
        e = (e_sic[0] + e_nuc, e_sic[1])

    except:
        # First SCF cycle: regular DFT energy.
        e = energy_elec(mf, dm=dm, h1e=h1e, vhf=vhf)

    return e
Exemple #2
0
 def energy_elec(self, dm, h1e=None, vhf=None):
     from pyscf.dft import uks
     if h1e is None: h1e = self.get_hcore()
     return uks.energy_elec(self, dm, h1e)
Exemple #3
0
 def energy_elec(self, dm, h1e=None, vhf=None):
     if h1e is None: h1e = ks.get_hcore()
     return uks.energy_elec(self, dm, h1e)