Skip to content

[UNEXPECTED BEHAVIOR] from_chk may give wrong electron count for fractional occupations #3650

Open

Description

@Jackcarzy

Describe the unexpected behavior
Since v2.13.0, restarting a PBC RHF/RKS calculation from a checkpoint with fractional
occupations (e.g. after smearing) builds a density matrix with too many electrons.

pbc.scf.hf.init_guess_by_chkfile calls pbc.scf.uhf.init_guess_by_chkfile and sums the
two spin DMs. The UHF reader splits each restricted occupation and relies on the
negative beta occupation to cancel. Then the negative beta parts are dropped and
each partly occupied orbital counts as fully occupied in alpha.

To Reproduce

import numpy as np
from pyscf.pbc import gto, scf

cell = gto.M(atom='Li 0 0 0; Li 1.75 1.75 1.75', a=np.eye(3)*3.5,
             basis='gth-szv', pseudo='gth-pade', verbose=0)
mf = scf.addons.smearing_(scf.RHF(cell), sigma=0.05, method='fermi')
mf.chkfile = 'li.chk'
mf.kernel()

S = mf.get_ovlp()
dm_ref = mf.make_rdm1()
dm_chk = scf.RHF(cell).from_chk('li.chk')
print('electrons, make_rdm1():', np.einsum('ij,ji', dm_ref, S).real)
print('electrons, from_chk()  :', np.einsum('ij,ji', dm_chk, S).real)
print('energy at make_rdm1() DM:', mf.energy_tot(dm_ref))
print('energy at from_chk() DM :', mf.energy_tot(dm_chk))

Output:

electrons, make_rdm1(): 6.0000000000000036
electrons, from_chk()  : 6.999957678285341
energy at make_rdm1() DM: -15.139134536641663
energy at from_chk() DM : -14.461800849792464

Expected behavior
from_chk() reproduces the checkpoint density (6 electrons).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions