Skip to content

solvent.smd: CDS term treats atoms with an ECP as other elements (atom_charges() used as atomic numbers) #3617

Open

Description

@coltonbh

pyscf/solvent/smd.py passes mol.atom_charges() to the MNSOL routine as atomic numbers. For atoms with an ECP, atom_charges() returns Z minus the core electrons, so the CDS term looks up the radii and surface tensions of a different element:

element atom_charges() with def2 ECP treated as
Xe 26 Fe
Sn 22 Ti
I 25 Mn
Bi 23 V
Pt 18 Ar

The def2 basis sets put ECPs on all of Rb–Rn, so every SMD calculation with those elements and a def2 basis gets the wrong G_CDS. The SMD gradient takes dcds from the same call, so it is affected too. The electrostatic part (v_grids_n, which also uses atom_charges()) is correct as is: there the effective nuclear charge is the right quantity.

Reproducer (PySCF 2.15.0):

import numpy as np
from pyscf import gto, scf
from pyscf.solvent import smd

mol = gto.M(atom="Xe 0 0 0; F 0 0 1.98; F 0 0 -1.98", basis="def2-svp", ecp="def2-svp")
so = scf.RHF(mol).SMD().with_solvent
so.solvent = "water"
print(mol.atom_charges())                              # [26  9  9]: Xe looked up as Fe
e_now = smd.get_cds_legacy(so)[0]
z = np.asarray([gto.charge(s) for s in mol.elements])  # [54  9  9]
mol.atom_charges = lambda: z
e_fixed = smd.get_cds_legacy(so)[0]
print(e_now, e_fixed, e_now - e_fixed)

Output: G_CDS 0.0033747341 vs 0.0029855181 Eh, a difference of +3.9e-4 Eh. For tetrahedral SnCl4 (Sn–Cl 2.31 Å) in toluene the difference is −8.4e-4 Eh (0.53 kcal/mol).

Suggested fix (get_cds_legacy, currently line 94 on master): pass the proton numbers.

charges = np.asarray([gto.charge(s) for s in mol.elements], dtype=np.int32, order='F')

mol._atm also holds the ECP-reduced charges, so it can't be used instead. The module notes it was adapted from GPU4PySCF, which may have the same line; I haven't checked.

With this change, PySCF's G_CDS agrees to about 2e-12 Eh with an independent SMD implementation for XeF2, SnCl4, BiCl3, PtCl4²⁻ and I2. We found this while cross-validating our own HF/DFT code against PySCF.

Activity

  1. added 3 commits that reference this issue on Nov 22, 2026
    9815d3d
    e5e4e50
    ff667cb
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