Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide initial guess for SCF step #8

Open
jeanwsr opened this issue Mar 29, 2025 · 2 comments
Open

Provide initial guess for SCF step #8

jeanwsr opened this issue Mar 29, 2025 · 2 comments

Comments

@jeanwsr
Copy link
Contributor

jeanwsr commented Mar 29, 2025

dh/pyscf/dh/rdfdh.py

Lines 50 to 56 in 2ac67ac

def energy_elec_nc(mf: RDFDH, mo_coeff=None, h1e=None, vhf=None, **_):
if mo_coeff is None:
if mf.mf_s.e_tot == 0:
mf.run_scf()
if mf.xc_n is None: # if bDH-like functional, just return SCF energy
return mf.mf_s.e_tot - mf.mf_s.energy_nuc(), None
mo_coeff = mf.mf_s.mo_coeff

Since kwargs are not passed to run_scf, so currently it's not possible to pass initial guess, is it?

So I'm wondering which solution is preferred: allow users passing dm0 in as kwargs, or encourage users running mf.mf_s manually after DH initialized?

An even more flexible implementation could be allow initializing upon mf_or_mol, like

https://github.com/pyscf/pyscf/blob/0785373fb5f11105bc41743565cf4b7e13464c92/pyscf/mcscf/casci.py#L779

@jeanwsr
Copy link
Contributor Author

jeanwsr commented Mar 29, 2025

After some experiment I found mf.mf_s.kernel(dm0=dm) is not recomended since it will leave mf.mo_coeff undefined.
Running mf.run_scf(dm0=dm); mf.run() seems reasonable.

@ajz34
Copy link
Owner

ajz34 commented Mar 31, 2025

For this implementation, it is actually encouraged for users running mf.mf_s manually after DH initialized. The attribute mf.mf_s can be arbitrarily changed by user for their demands.
It is not a good way for API design, only scripting available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants