You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
solvent.smd: CDS term treats atoms with an ECP as other elements (atom_charges() used as atomic numbers) #3617
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):
importnumpyasnpfrompyscfimportgto, scffrompyscf.solventimportsmdmol=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_solventso.solvent="water"print(mol.atom_charges()) # [26 9 9]: Xe looked up as Fee_now=smd.get_cds_legacy(so)[0]
z=np.asarray([gto.charge(s) forsinmol.elements]) # [54 9 9]mol.atom_charges=lambda: ze_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.
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
Fix SMD CDS term for atoms with an ECP
Fix SMD CDS term for atoms with an ECP
Fix SMD CDS term for atoms with an ECP