Skip to content

Commit

Permalink
Auxbasis with keyword etb
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqm committed Aug 27, 2024
1 parent 44b2a20 commit fb63491
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
34 changes: 25 additions & 9 deletions pyscf/df/addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def aug_etb_for_dfbasis(mol, dfbasis=DFBASIS, beta=ETB_BETA,
nuc_charge = gto.charge(symb)
if nuc_charge < nuc_start:
newbasis[symb] = dfbasis
#?elif symb in mol._ecp:
else:
conf = elements.CONFIGURATION[nuc_charge]
max_shells = 4 - conf.count(0)
Expand Down Expand Up @@ -182,7 +181,7 @@ def make_auxbasis(mol, mp2fit=False):
auxbasis.update(auxdefault)
aux_etb = set(auxbasis) - set(auxdefault)
if aux_etb:
logger.info(mol, 'Even tempered Gaussians are generated as '
logger.warn(mol, 'Even tempered Gaussians are generated as '
'DF auxbasis for %s', ' '.join(aux_etb))
for k in aux_etb:
logger.debug(mol, ' ETB auxbasis for %s %s', k, auxbasis[k])
Expand All @@ -198,26 +197,43 @@ def make_auxmol(mol, auxbasis=None):
even-tempered Gaussian basis set will be generated.
See also the paper JCTC, 13, 554 about generating auxiliary fitting basis.
JCP, 127, 074102
Kwargs:
auxbasis : str, list, tuple
Similar to the input of orbital basis in Mole object.
'''
pmol = mol.copy(deep=False)

if auxbasis is None:
auxbasis = make_auxbasis(mol)
elif isinstance(auxbasis, str) and '+etb' in auxbasis:
elif auxbasis == 'etb':
auxbasis = aug_etb_for_dfbasis(mol, start_at=0)
elif '+etb' in auxbasis:
dfbasis = auxbasis[:-4]
auxbasis = aug_etb_for_dfbasis(mol, dfbasis)
pmol.basis = auxbasis

if isinstance(auxbasis, (str, list, tuple)):
uniq_atoms = {a[0] for a in mol._atom}
_basis = {a: auxbasis for a in uniq_atoms}
elif 'default' in auxbasis:
uniq_atoms = {a[0] for a in mol._atom}
_basis = {a: auxbasis['default'] for a in uniq_atoms}
_basis.update(auxbasis)
del (_basis['default'])
uniq_atoms = set([a[0] for a in mol._atom])
_basis = dict([(a, auxbasis) for a in uniq_atoms])
else:
_basis = auxbasis
assert isinstance(auxbasis, dict)
if 'default' in auxbasis:
uniq_atoms = {a[0] for a in mol._atom}
_basis = {a: auxbasis['default'] for a in uniq_atoms}
_basis.update(auxbasis)
del (_basis['default'])
else:
_basis = auxbasis
if 'etb' in _basis.values():
etb_abs = aug_etb_for_dfbasis(mol, start_at=0)
for elem, bas in _basis.items():
if bas == 'etb':
_basis[elem] = auxbasis_etb[elem]

pmol._basis = pmol.format_basis(_basis)

# Note: To pass parameters like gauge origin, rsh-omega to auxmol,
Expand Down
2 changes: 1 addition & 1 deletion pyscf/gto/mole.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def converter(symb, raw_basis):
_basis = load(raw_basis, _std_symbol_without_ghost(symb))
elif (any(isinstance(x, str) for x in raw_basis)
# The first element is the basis of internal format
or not isinstance(raw_basis[0][0], int)):
or not isinstance(raw_basis[0][0], (numpy.integer, int))):
stdsymb = _std_symbol_without_ghost(symb)
_basis = []
for rawb in raw_basis:
Expand Down

0 comments on commit fb63491

Please sign in to comment.