Skip to content

Commit

Permalink
fix chemcore bug when ecp exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanwsr authored and sunqm committed Apr 1, 2023
1 parent df92512 commit 6abf32e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions examples/cc/11-frozen_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@
# number of elec screened by ECP > number of chemical core electrons
#
mol = gto.M(
atom = 'Mg 0 0 0',
basis = 'def2-svp')
atom = 'Xe 0 0 0',
basis = 'cc-pvtz-dk')
mf = scf.RHF(mol).run()
mycc = cc.CCSD(mf)
mycc.set_frozen()
print('Number of core orbital frozen: %d' % mycc.frozen)
mol.set(basis='lanl2dz', ecp='lanl2dz').build()
mol.set(basis='def2-svp', ecp='def2-svp').build()
mf = scf.RHF(mol).run()
mycc = cc.CCSD(mf)
mycc.set_frozen()
Expand Down
7 changes: 3 additions & 4 deletions pyscf/data/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -1102,13 +1102,12 @@ def chemcore(mol, spinorb=False):
atm_nelec = mol.atom_charge(a)
atm_z = charge(mol.atom_symbol(a))
ne_ecp = atm_z - atm_nelec
ncore_ecp = ne_ecp // 2
atm_ncore = chemcore_atm[atm_z]
if ne_ecp == 0:
core += atm_ncore
elif ne_ecp > atm_ncore:
if ncore_ecp > atm_ncore:
core += 0
else:
core += atm_ncore - ne_ecp
core += atm_ncore - ncore_ecp

if spinorb:
core *= 2
Expand Down

0 comments on commit 6abf32e

Please sign in to comment.